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





<script language="javascript">
  function PrintMeY(invoiceID) {
    var disp_setting="toolbar=yes,location=no,";
    disp_setting+="directories=yes,menubar=yes,";
    disp_setting+="scrollbars=yes,width=650, height=600, left=100, top=25";
    var content_vlue = document.getElementById(invoiceID).innerHTML;
    var docprint=window.open("","",disp_setting);
    docprint.document.open();
    docprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"');
    docprint.document.write('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
    docprint.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">');
    docprint.document.write('<head><title>Print</title>');
    docprint.document.write('<style type="text/css">body{ margin:0px;');
    docprint.document.write('font-family:SolaimanLipi, Arial,verdana;color:#000;');
    docprint.document.write('font-family:SolaimanLipi, Arial, Geneva, sans-serif; font-size:10px;width: 288px;}');
    docprint.document.write('a{color:#000;text-decoration:none;} </style>');
    docprint.document.write('</head><body onLoad="self.print()">');
    docprint.document.write(content_vlue);
    docprint.document.write('</body></html>');
    docprint.document.close();
    docprint.focus();
  }
</script>

<section class="content">
  <div class="row">
    <div class="col-md-12">
      <div class="card card-primary card-outline direct-chat direct-chat-primary shadow-none" style="border-left:1px solid black;border-right:1px solid black;border-bottom:1px solid black;">
        <div class="card-header" style="padding: 3px 8px;">
          <h3 class="card-title">Purchase Invoice </h3>
          <div class="card-tools">
            <button type="button" class="btn btn-tool" onclick="PrintMeY('invoiceID')" title="Print Now"><i class="fas fa-print"></i></button>
       
            <button type="button" class="btn btn-tool" data-card-widget="remove" data-dismiss="modal">
              <i class="fas fa-times"></i>
            </button>
          </div>
        </div>   

        <div class="card-body p-1" id="invoiceID" style="overflow:hidden;position: relative;">
          <div class="col-lg-12">
            <div style="float: left; width: 100%;margin-top: -5px;text-align: center;">
              <address style="margin-bottom: 0px;font-size: 11px;margin-top: 5px;">
                <strong style="font-weight: bold;font-size:<?php echo $rowps['com_font_size'];?>px;color:<?php echo $rowps['com_color'];?>;"><?php echo $rowps['company_name'];?></strong><hr style="margin: 0px 0px;border: 0.5px solid #066265;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
               <?php echo $rowps['company_address'];?>
                <?php echo $rowps['company_phone'];?> # <?php echo $rowps['company_email'];?>
              </address>
              <hr style="margin:0px 0px;border:0.5px solid #066265;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
            </div>
            <div style="float:left;width: 100%;">
              <div style="padding: 0px;min-height: 20px;min-height: 20px; margin-bottom: 2px;border: 1px solid #e3e3e3;border-radius: 2px;">
                <div class="clearfix">
                  <div><strong><center><b style="font-size: 19px;<?php if ($rowps['bg_color'] !== "" ) { echo 'color:'.$rowps['bg_color'];} ?>">Purchase Invoice</b></center></strong></div>
                </div>
              </div>
              <hr style="margin-top: 0px; margin-bottom: 2px;border: 0.5px solid #066265;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
            </div>
            <div class="col-xs-12" style="float:left;width:100%">
              <div style="padding: 5px; font-size:8px;">
                <div>

                  <?php if ($rowps['m_invoice']=="On") {  ?>
                  <div  style="float: left; width: 100%;font-size: 12px"> MEMO NO :<?php echo 'Menual Invoice No ';?></div> 
                    <?php } ?>


                    <?php if ($rowps['print_time']=="On") {  ?>
                    <div  style="float: left; width: 100%;font-size: 12px"> PRINT TIME : <?php echo date('d/m/y h:i:s a', strtotime($datetime));?></div> 
                    <?php } ?>



                  <div  style="float: left; width: 100%;font-size: 12px"> VOUCHER NO : <?php echo 'invoice' ?></div> 
                  <div  style="float: left; width: 100%;font-size: 12px"> DATE TIME  : <?php echo 'datetime';?> </div>
                </div>
              </div>
            </div>
             <hr style="margin-top:0px;margin-bottom:2px;border:0.5px solid #066265;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">


            <div class="col-xs-12" style="float: left; width: 100%;font-size: 12px;">
              <address style="font-size: 12px;margin-bottom: 0px; margin-top: 1px;line-height: 20px;border-bottom: 1.3px dotted;">
                Name : <?php echo 'ac_name'; ?>
              </address>
            </div>
            <div class="col-xs-4" style="float: left; width: 100%;font-size: 12px;">
                <address style="font-size: 12px;margin-bottom: 0px; margin-top: 1px;line-height: 20px;border-bottom: 1.3px dotted;">
                 Mobile: <?php echo 'ac_number'; ?>
               </address>
            </div>
            <div class="col-xs-4" style="float: left; width: 100%;font-size: 12px;">
                <address style="font-size: 12px;margin-bottom: 0px; margin-top: 1px;line-height: 20px;border-bottom: 1.3px dotted;">
                       Address : <?php echo 'ac_address'; ?>
                </address>
            </div>
<!-- frist part complete -->





   <div class="col-xs-12" style="float: left; width: 100%">

    <br/>
    <table cellpadding="0"  cellspacing="0"  class=" t-table" style="font-size: 10px; width: 100%; margin-bottom: 3px;margin-top: -10px;">
      <tr>
        <th style="font-size: 12px;text-align:center;width: 8%;<?php if ($rowps['bg_color'] !== "" ) { echo 'color:'.$rowps['text_color'];} ?>!important;<?php if ($rowps['bg_color'] !== "" ) { echo 'background:'.$rowps['bg_color'];} ?>!important;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>!important">S/L</th>
        <th style="font-size: 12px;text-align:left;color:white; <?php if ($rowps['bg_color'] !== "" ) { echo 'background:'.$rowps['bg_color'];} ?>;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Discription</th>
        <th style="font-size: 12px;text-align:center;color:white;width: 5%;<?php if ($rowps['bg_color'] !== "" ) { echo 'background:'.$rowps['bg_color'];} ?>;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Unit</th>
        <th style="font-size: 12px;text-align:center;color:white;width: 15%;<?php if ($rowps['bg_color'] !== "" ) { echo 'background:'.$rowps['bg_color'];} ?>;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Price</th>
        <th style="font-size: 12px;text-align:center;color:white;width: 15%;<?php if ($rowps['bg_color'] !== "" ) { echo 'background:'.$rowps['bg_color'];} ?>;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Total</th>

      </tr>
    </thead>

    <tbody>



      <tr> 
        <td style="font-size: 12px;text-align: center;width: 5%;border-left: 0.1px solid black;border-right: 0.1px solid black; border-bottom: 0.1px solid black; border-top: 0.1px solid black;padding: 0px 3px;overflow-x: hidden;overflow-y: hidden;white-space: nowrap;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>" >1</td>


        <td style="font-size: 12px;text-align:left;padding: 4px;border-left: 0.1px solid black;border-right: 0.1px solid black; border-bottom: 0.1px solid black; border-top: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
 <?php if ($rowps['item_group']=="On") {
              echo 'item_group';
              } if ($rowps['item_brand']=="On"){
              echo 'item_brand';
              } if ($rowps['item_catagory']=="On"){
              echo 'item_catagory';
              } ;?>
              <?php echo 'item_name';?> <?php echo 'item_details';?> ,  <?php if ($rowps['item_code']=="On") {echo 'item_code'; } ?>
              <?php if ($rowps['item_warranty']=="On") {echo 'item_warranty';} ?>
        </td>

        <td style="font-size: 12px;text-align:center;padding: 4px;border-left: 0.1px solid black;border-right: 0.1px solid black; border-bottom: 0.1px solid black; border-top: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"> 
          <?php echo 500;?> </td>

        <td style="font-size: 12px;text-align:right;padding: 4px;border-left: 0.1px solid black;border-right: 0.1px solid black; border-bottom: 0.1px solid black; border-top: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"> 
          <?php echo 500;?> </td>


          <td style="font-size: 10px;text-align:right;width: 13%;border-left: 0.1px solid black;border-right: 0.1px solid black; border-bottom: 0.1px solid black; border-top: 0.1px solid black; padding: 0px 3px;border-right: 0.1px solid black;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"><?php echo 500;?></td>
        </tr>




      <tr>
          <td colspan="2" style="font-size: 12px;text-align:right;border-left: 0.1px solid black;border-bottom: 0.1px solid black;border-top: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"> Total = </td>

          <td style="font-size: 12px;text-align:center;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;border-top: 0.1px solid black;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
           <?php echo 500;?>
          </td>

          <td style="font-size: 12px;text-align:right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;border-top: 0.1px solid black;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"></td>

          <td style="font-size: 12px;text-align:right; border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;border-right: 0.1px solid black;border-top: 0.1px solid black;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
           <b style="font-size: 13; "> <?php echo 500;?>
         </b> 
       </td>
     </tr>


        <tr>
   	  	<td></td>
     	<td></td>
     	<td></td>
    <td  style="font-size: 12px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Delivery Charge :</td>
    <td  style="text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
    <?php echo 500;?>
    </td>
  </tr>
     <tr>
     	<td></td>
     	<td></td>
     	<td></td>
      <td  style="font-size: 12px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Discount</td>
      <td  style="text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">
          <?php echo 500;?>
      </td>
    </tr>

<tr>
     	<td></td>
     	<td></td>
     	<td></td>
  <td  style="font-size: 13px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>" >Grand Total</td>
  <td  style="font-size: 13px;text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"><b><?php echo 500;?>
    </b>    
  </td>
</tr>

<tr>
	  	<td></td>
     	<td></td>
     	<td></td>
  <td  style="font-size: 12px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Payment</td>
  <td style="text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"><?php echo 500;?>
  </td>
</tr>

<tr>

	  	<td></td>
     	<td></td>
     	<td></td>
  <td  style="font-size: 12px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Current Invoice Due</td>
  <td style="text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"><?php echo 500;?>
</td>
</tr>


                  <?php if ($rowps['previous_due']=="On") { ?>


<tr>
	<td></td>
    <td></td>
    <td></td>
  <td  style="font-size: 12px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Previous Balance</td>
  <td style="text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"> 
  <?php echo 500;?>
  </td>
</tr>
<?php } ?>


        <?php if ($rowps['current_in_due']=="On") { ?>

<tr>
	  	<td></td>
     	<td></td>
     	<td></td>
  <td  style="font-size: 12px;text-align: right;border-left: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>">Current Due</td>
  <td style="text-align: right;border-left: 0.1px solid black;border-right: 0.1px solid black;border-bottom: 0.1px solid black; padding: 0px 3px;<?php if ($rowps['bg_color'] !== "" ) { echo 'border-color:'.$rowps['bg_color'];} ?>"> 
 <?php echo 500;?>
  </td>
</tr>
<?php } ?>



</tbody>
</table>
</div>







<div class="col-xs-12" style="font-size: 10px;float: left; width: 100%">
  <address style="font-size: 10px;margin-bottom: 0px; margin-top: 11px;margin-left:15px; line-height: 20px;border-bottom: 1.3px dotted;text-transform: uppercase;">
   In Word :  <?php echo "one thousand only ";?>
 </address>
</div><!--end .col -->

















<div class="col-xs-12" id="footer" style="float: left; width: 100%">
  <address style="margin-bottom: 0px; margin-top: 5px;line-height: 12px;">
    <table style="width: 100%;">
      <tr>
        <td class="hidden-border" style="font-size: 10px; width: 50%;text-align: center">
         Receiver
       </td>
       <td class="hidden-border" style="font-size: 10px; width: 50%; text-align: center">
        Authorized
      </td>
    </tr>
  </table>
  <br>


  <div class="col-sm-12" style="width: 100%;<?php if ($rowps['bg_color'] !== "" ) { echo 'background:'.$rowps['bg_color'];} ?>;color:white;">
    <ssssss style= "font-size: 8px"> <center><b>&nbsp;Powered by: WellDiv # Web: www.welldiv.com</b></center> </ssssss>
  </div>




</address>
</div>


</div>
</div>
</div>
</div>
</div>
</section>


<style type="text/css">
  @font-face { 
    font-family: SolaimanLipi; 
    src: local('SolaimanLipi'),
    url('../../fonts/solaimanlipi.woff') format('woff'),
    url('../../fonts/solaimanlipi.woff2') format('woff2');
  }


  @page { margin: 0 }
  body { margin: 0 }
  .sheet {
    margin: 0;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    page-break-after: always;
    font-size: 10px;
  }

/** Paper sizes **/
body.A3               .sheet { width: 299mm; height: 419mm }
body.A3.landscape     .sheet { width: 420mm; height: 296mm }
body.A4               .sheet { width: 210mm; height: 296mm }
body.A4.landscape     .sheet { width: 297mm; height: 209mm }
body.A5               .sheet { width: 148mm; height: 209mm }
body.A5.landscape     .sheet { width: 210mm; height: 147mm }
body.letter           .sheet { width: 216mm; height: 279mm }
body.letter.landscape .sheet { width: 280mm; height: 215mm }
body.legal            .sheet { width: 216mm; height: 356mm }
body.legal.landscape  .sheet { width: 357mm; height: 215mm }

/** Padding area **/
.sheet.padding-10mm { padding: 10mm }
.sheet.padding-15mm { padding: 15mm }
.sheet.padding-20mm { padding: 20mm }
.sheet.padding-25mm { padding: 25mm }

/** For screen preview **/
@media screen {
  body { background: #e0e0e0 }
  .sheet {
    background: white;
    box-shadow: 0 .5mm 2mm rgba(0,0,0,.3);
    margin: 5mm auto;
  }
}

/** Fix for Chrome issue #273306 **/
@media print {
 body.A3.landscape { width: 420mm }
 body.A3, body.A4.landscape { width: 297mm }
 body.A4, body.A5.landscape { width: 210mm }
 body.A5                    { width: 148mm }
 body.letter, body.legal    { width: 216mm }
 body.letter.landscape      { width: 280mm }
 body.legal.landscape       { width: 357mm }
}

</style>
</div>
</div>
</div>
</div>
</div>


</section>