<?php require_once('../auth/auth.php');?>
<?php  
$comid=$_GET['comid'];
$pritner_setup_query= mysqli_query($conn,"SELECT * FROM printer_setup WHERE coid ='$comid' AND bid ='$bid' AND brid='$brid' LIMIT 1 ") or die (mysql_error());
 $rowps= mysqli_fetch_assoc ($pritner_setup_query);
 $psid=$rowps['psid'];




$cfid_check_default = mysqli_query($conn,"SELECT psid  FROM printer_setup WHERE coid='$comid'");
 $count = mysqli_num_rows($cfid_check_default);
if($count < 1){
mysqli_query($conn,"INSERT INTO `printer_setup`( `coid`, `bid`, `brid`) VALUES ('$comid','$bid','$brid')")or die(mysqli_error($conn));
}


?>
<section class="content">
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-3">
                <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid #969c9d;border-right:1px solid #969c9d;border-bottom:1px solid #969c9d;">
                    <div class="card-header" style="padding: 5px 8px;"><h3 class="card-title"><?php echo language(336);?></h3> <div class="card-tools"> <button type="button" class="btn btn-tool" data-card-widget="remove"> <i class="fas fa-times"></i>  </button> </div>
                </div>
                    <div class="card-body">
                        <div class="col-md-12">
                            <div class="row mt-2">

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(339); ?> </label>
                                    <select  id="layout" name="layout" value="<?php echo $rowps['layout'];?>" col_name="layout"  psid="<?php echo $psid;?>" class="form-control select2 onlive"  >
                                          <option selected value="<?php echo $rowps['layout'];?>"> 
                                            <?php 
                                                if ($rowps['layout']==1) {
                                                    echo "Default Invoice  A4";
                                                }else if($rowps['layout']==2){
                                                    echo "Pos Invoice";
                                                }
                                            ?>
                                             </option>
                                          <option value="1">   Default Invoice  A4 </option>
                                          <option value="2">   Pos Invoice  A4 </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(321);?> <b class="text-danger"> *</b></label>
                                        <input type="text" name="company_name"  value="<?php echo $rowps['company_name'];?>" col_name="company_name" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(321);?> <?php echo language(338);?> <b class="text-danger"> *</b></label>
                                        <input type="number" name="com_font_size"  max="30"  value="<?php echo $rowps['com_font_size'];?>" col_name="com_font_size" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div>
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(342);?>  <b class="text-danger"> *</b></label>
                                        <input type="color" name="com_color"  value="<?php echo $rowps['com_color'];?>" col_name="com_color" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div> 

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(112);?>  <b class="text-danger"> *</b></label>
                                        <input type="email" name="company_email"  max="30"  value="<?php echo $rowps['company_email'];?>" col_name="company_email" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(111);?>  <b class="text-danger"> *</b></label>
                                        <input type="text" name="company_phone"  max="30"  value="<?php echo $rowps['company_phone'];?>" col_name="company_phone" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(116);?>  <b class="text-danger"> *</b></label>
                                        <input type="text" name="company_address"  max="30"  value="<?php echo $rowps['company_address'];?>" col_name="company_address" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div>
                                
                               <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(158); ?> </label>
                                    <select  name="branch_info" value="<?php echo $rowps['branch_info'];?>" col_name="branch_info"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['branch_info'];?>"> <?php echo $rowps['branch_info']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(333); ?> </label>
                                    <select  name="wh_info" value="<?php echo $rowps['wh_info'];?>" col_name="wh_info"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['wh_info'];?>"> <?php echo $rowps['wh_info']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(152); ?> </label>
                                    <select  name="dman_info" value="<?php echo $rowps['dman_info'];?>" col_name="dman_info"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['dman_info'];?>"> <?php echo $rowps['dman_info']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(224); ?> </label>
                                    <select  name="route_info" value="<?php echo $rowps['route_info'];?>" col_name="route_info"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['route_info'];?>"> <?php echo $rowps['route_info']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(420); ?> </label>
                                    <select  name="cemail_info" value="<?php echo $rowps['cemail_info'];?>" col_name="cemail_info"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['cemail_info'];?>"> <?php echo $rowps['cemail_info']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(419); ?> </label>
                                    <select  name="ins_info" value="<?php echo $rowps['ins_info'];?>" col_name="ins_info"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['ins_info'];?>"> <?php echo $rowps['ins_info']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                

                                

                               <div class="col-md-6">
                                    <div class="form-group">
                                        <label> <?php echo language(340);?>  <b class="text-danger"> *</b></label>
                                        <input type="color" name="bg_color"  value="<?php echo $rowps['bg_color'];?>" col_name="bg_color" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div> 
                                
                                <div class="col-md-6">
                                    <div class="form-group">
                                        <label>Font <?php echo language(340);?>  <b class="text-danger"> *</b></label>
                                        <input type="color" name="text_color"  value="<?php echo $rowps['text_color'];?>" col_name="text_color" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div> 

                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(421);?>  <b class="text-danger"> *</b></label>
                                        <input type="color" name="border_color"  value="<?php echo $rowps['border_color'];?>" col_name="border_color" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                    </div>
                                </div> 

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(341); ?>  </label><button class="btn btn-primary btn-xs float-right" style="background:<?php echo $rowps['head_bg'];?> !important;color:black;">  background </button>
                                    <select  name="head_bg" value="<?php echo $rowps['head_bg'];?>" col_name="head_bg"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option  selected value="<?php echo $rowps['head_bg'];?>"> selected </option>
                                          <option value="rgba(14 27 227 / 10%)">  Blue </option>
                                          <option value="rgba(255 12 12 / 10%)"> Danger </option>
                                          <option value="rgba(0 255 43 / 10%)"> Green </option>
                                          <option value="rgb(17 33 41 / 10%)"> Gray </option>


                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label> <?php echo language(337);?> <b class="text-danger"> *</b></label>
                                     <textarea name="terms" col_name="terms" psid="<?php echo $psid;?>"  class="form-control form-control-sm   onlive" rows="3" placeholder="Enter ..."> <?php echo $rowps['terms'];?> </textarea>
                                    </div>
                                </div>

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(343); ?> </label>
                                    <select  name="invoice_tin" value="<?php echo $rowps['invoice_tin'];?>" col_name="invoice_tin"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['invoice_tin'];?>"> <?php echo $rowps['invoice_tin']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                <div class="col-md-12">
                                  <div class="form-group">
                                    <label>  <?php echo language(344); ?> </label>
                                    <select  name="invoice_logo" value="<?php echo $rowps['invoice_logo'];?>" col_name="invoice_logo"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['invoice_logo'];?>"> <?php echo $rowps['invoice_logo']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(150); ?> </label>
                                    <select name="invoice_narrtion" value="<?php echo $rowps['invoice_narrtion'];?>" col_name="invoice_narrtion"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['invoice_narrtion'];?>"> <?php echo $rowps['invoice_narrtion']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                 <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(337); ?> </label>
                                    <select  name="invoice_trams" value="<?php echo $rowps['invoice_trams'];?>" col_name="invoice_trams"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['invoice_trams'];?>"> <?php echo $rowps['invoice_trams']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>



                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(16); ?> </label>
                                    <select name="item_group" value="<?php echo $rowps['item_group'];?>" col_name="item_group"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['item_group'];?>"> <?php echo $rowps['item_group']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                 <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(21); ?> </label>
                                    <select name="item_brand" value="<?php echo $rowps['item_brand'];?>" col_name="item_brand"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['item_brand'];?>"> <?php echo $rowps['item_brand']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(19); ?> </label>
                                    <select name="item_catagory" value="<?php echo $rowps['item_catagory'];?>" col_name="item_catagory"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['item_catagory'];?>"> <?php echo $rowps['item_catagory']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                 <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(78); ?> </label>
                                    <select name="item_code" value="<?php echo $rowps['item_code'];?>" col_name="item_code"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['item_code'];?>"> <?php echo $rowps['item_code']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>
                                
                                  <div class="col-md-12">
                                  <div class="form-group">
                                    <label> <?php echo language(410);  ?> </label>
                                 <input type="text" name="imei_sl_text"  value="<?php echo $rowps['imei_sl_text'];?>" col_name="imei_sl_text" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                  </div>
                                </div>

                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(86); ?> </label>
                                    <select name="item_warranty" value="<?php echo $rowps['item_warranty'];?>" col_name="item_warranty"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['item_warranty'];?>"> <?php echo $rowps['item_warranty']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                            <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(345); ?> </label>
                                    <select  name="print_time" value="<?php echo $rowps['print_time'];?>" col_name="print_time"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['print_time'];?>"> <?php echo $rowps['print_time']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(346); ?> </label>
                                    <select  name="sig_nature" value="<?php echo $rowps['sig_nature'];?>" col_name="sig_nature"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['sig_nature'];?>"> <?php echo $rowps['sig_nature']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(151); ?> </label>
                                    <select  name="m_invoice" value="<?php echo $rowps['m_invoice'];?>" col_name="m_invoice"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['m_invoice'];?>"> <?php echo $rowps['m_invoice']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>

                        

                               <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(236); ?> </label>
                                    <select  name="previous_due" value="<?php echo $rowps['previous_due'];?>" col_name="previous_due"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['previous_due'];?>"> <?php echo $rowps['previous_due']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>


                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(147); ?> </label>
                                    <select name="current_in_due" value="<?php echo $rowps['current_in_due'];?>" col_name="current_in_due"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['current_in_due'];?>"> <?php echo $rowps['current_in_due']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>
                                
                                 
                                
                                
                                   <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(381);  ?> </label>
                                 <input type="text" name="fop_one"  value="<?php echo $rowps['fop_one'];?>" col_name="fop_one" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                  </div>
                                </div>
                                
                                   <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(382);  ?> </label>
                                     <input type="text" name="fop_two"  value="<?php echo $rowps['fop_two'];?>" col_name="fop_two" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                  </div>
                                </div>
                                
                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(383);  ?> </label>
                                    <input type="text" name="fop_three"  value="<?php echo $rowps['fop_three'];?>" col_name="fop_three" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                  </div>
                                </div>
                                
                                <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo language(384);  ?> </label>
                                    <input type="text" name="fop_four"  value="<?php echo $rowps['fop_four'];?>" col_name="fop_four" psid="<?php echo $psid;?>" class="form-control form-control-sm  onlive" required="true">
                                  </div>
                                </div>
                                
                         
                                
                                 <div class="col-md-6">
                                  <div class="form-group">
                                    <label>  <?php echo 'In Word';  ?> </label>
                                    <select name="current_in_due" value="<?php echo $rowps['invoice_inword'];?>" col_name="invoice_inword"  psid="<?php echo $psid;?>" class="form-control select2 onlive" style="width: 100%" >
                                          <option selected value="<?php echo $rowps['invoice_inword'];?>"> <?php echo $rowps['invoice_inword']; ?> </option>
                                          <option value="On"> On </option>
                                          <option value="Of"> Of </option>
                                    </select>
                                  </div>
                                </div>



                            </div>
                        </div>
                    </div>
                </div>
            </div>
        <div class="col-md-9"   id="row_show<?php echo $rowps['layout'];?>">  </div>
    </div>
</div>
</section>
                             

<script type="text/javascript">
<?php if ( $rowps['layout'] ==1){ ?>

              pagecall('../print_setup/sales_invoice_default.php?layout=<?php echo $rowps['layout'];?>','#row_show<?php echo $rowps['layout'];?>',0);  

<?php } else if($rowps['layout'] ==2){ ?>
              pagecall('../print_setup/sales_invoice_pos.php?layout=<?php echo $rowps['layout'];?>','#row_show<?php echo $rowps['layout'];?>',0);  


<?php } ?>
    

  $(document).ready(function() {
        $("select").select2();
    $(".onlive").on(' change blur', function(){
      psid = $(this).attr("psid");
      col_name = $(this).attr("col_name");
      col_value = $(this).val();
      $.ajax({
        type: "POST",
        url: "../company_setup/printer_setup_db.php",
        data: ({psid: psid,col_name: col_name,col_value:col_value}),
        cache:false,
      });


      $.post('../company_setup/printer_setup.php?comid='+'<?php echo $comid ;?>',{},function(res){
       $('#com_profile_view',0).html(res);
       toastr.success(Showing, '<?php echo "Data Load Succefully " ?>');
     }); 


    });
  });
</script>







