<?php include("parent/callMe.php"); ?>
<?php  include("sessioncheck.php");


//$m->where("Status",'1');
 $m->orderBy("branch_id","desc");
 $m->where("branch_id", $_GET['branch']);
 $branches = $m->get("edu_branch_config");

  $m->where("branch_id", $_GET['branch']);
  $m->where("year",$_GET['year']);
  $m->where("month_id", $_GET['month']);
  $data=$m->get("eduportal_school_billing");


  $m->where("Month_Id", $_GET['month']);
  $month=$m->get(" eduportal_month_config");


?>
 <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />
<title>Invoice</title>
<!-- Favicons-->
<link rel="icon" type="image/png" href="img/favicon.png" sizes="32x32" />

<script type="text/javascript">
  //window.print();
</script>
<style> 

.section{width:94%; height:28.5cm;float:left; /*background-color:lightgray;border: 1px solid black;*/margin:0 auto;padding:1%;margin-left:1%;}
 
 tr td {
    
    padding:1.2%;
 }

  tr th {
    padding:2%;
    font-size:14px;
    background:lightgray; 
 }
.tdalign{text-align:center;border:1px solid black;}
  

body {
  background: rgb(204,204,204);
  font-weight:; 
}
page {
  background: white;
  display: block;
  margin: 0 auto;
  margin-bottom: 0.5cm;
  border:1px solid black;
  box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
  /*padding:1%;*/
}
page[size="A4"] {  
  width: 21cm;
  height: 29.7cm; 
}
page[size="A4"][layout="landscape"] {
  width: 29.7cm;
  height: 21cm;  
}
page[size="A3"] {
  width: 29.7cm;
  height: 42cm;
}
page[size="A3"][layout="landscape"] {
  width: 42cm;
  height: 29.7cm;  
}
page[size="A5"] {
  width: 14.8cm;
  height: 21cm;
}
page[size="A5"][layout="landscape"] {
  width: 21cm;
  height: 14.8cm;  
}
@media print {
  body, page {
    margin: 0;
    box-shadow: none;
    border:none;
  
  }
}

#container {
  font: normal 13px/1.4em 'Open Sans', Sans-serif;
  margin: 0 auto;
  min-height: 1158px;
  position: relative;
}

.left-stripes {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100px;
  background: url("images/stripe-bottom.png") center bottom no-repeat, url("images/stripe-bg.jpg") repeat;
}
.left-stripes .circle {
  -moz-border-radius: 50%;
  -webkit-border-radius: 50%;
  border-radius: 50%;
  background: #415472;
  width: 30px;
  height: 30px;
  position: absolute;
  left: 33%;
}
.left-stripes .circle.c-upper {
  top: 440px;
}
.left-stripes .circle.c-lower {
  top: 690px;
}

.right-invoice {
  padding: 40px 30px 40px 30px;
  min-height: 1078px;
}

#memo .company-info {
  float: left;
}
#memo .company-info div {
  font-size: 28px;
  text-transform: uppercase;
  min-width: 20px;
  line-height: 1em;
}
#memo .company-info span {
  font-size: 12px;
  color: #858585;
  display: inline-block;
  min-width: 20px;
}
#memo .logo {
  float: right;
  margin-left: 15px;
}
 .logo img {
  width: 115px;
  height: 117px;
}
#memo:after {
  content: '';
  display: block;
  clear: both;
}

#invoice-title-number {
  margin: 50px 0 20px 0;
  display: inline-block;
  float: left;
}
#invoice-title-number .title-top {
  font-size: 15px;
  margin-bottom: 5px;
}
#invoice-title-number .title-top span {
  display: inline-block;
  min-width: 20px;
}
#invoice-title-number .title-top #number {
  text-align: right;
  float: right;
  color: #858585;
}
#invoice-title-number .title-top:after {
  content: '';
  display: block;
  clear: both;
}
#invoice-title-number #title {
  display: inline-block;
  background: #415472;
  color: white;
  font-size: 50px;
  padding: 7px;
  font-family: Sanchez, Serif;
  line-height: 1em;
}

#client-info {
  float: right;
  text-align: right;
  margin-top: 50px;
  min-width: 220px;
}
#client-info .client-name {
  font-weight: bold;
  font-size: 15px;
  text-transform: uppercase;
  margin: 7px 0;
}
#client-info > div {
  margin-bottom: 3px;
  min-width: 20px;
}
#client-info span {
  display: block;
  min-width: 20px;
}
#client-info > span {
  text-transform: uppercase;
  color: #858585;
  font-size: 15px;
}

table {
  table-layout: fixed;
}
table th, table td {
  vertical-align: top;
  word-break: keep-all;
  word-wrap: break-word;
}

#invoice-info {
  float: left;
  margin-top: 10px;
  margin-bottom: 25px;
}
#invoice-info div {
  margin-bottom: 3px;
}
#invoice-info div span {
  display: inline-block;
  min-width: 20px;
  min-height: 18px;
}
#invoice-info div span:first-child {
  font-weight: bold;
  text-transform: uppercase;
  margin-right: 10px;
}
#invoice-info:after {
  content: '';
  display: block;
  clear: both;
}

.currency {
  margin-top: 20px;
  text-align: right;
  color: #858585;
  font-style: italic;
  font-size: 12px;
}
.currency span {
  display: inline-block;
  min-width: 20px;
}

#items {
  margin-top: 10px;
}
#items .first-cell, #items table th:first-child, #items table td:first-child {
  width: 18px;
  text-align: right;
}
#items table {
  border-collapse: separate;
  width: 100%;
}
#items table th {
  font-family: Sanchez, Serif;
  font-size: 12px;
  text-transform: uppercase;
  padding: 5px 3px;
  text-align: right;
  background: #b0b4b3;
  color: white;
}
#items table th:nth-child(2) {
  width: 30%;
  text-align: left;
}
#items table th:last-child {
  text-align: right;
}
#items table td {
  padding: 10px 3px;
  text-align: right;
  border-bottom: 1px solid #ddd;
}
#items table td:first-child {
  text-align: left;
}
#items table td:nth-child(2) {
  text-align: left;
}

#sums {
  float: right;
  margin-top: 30px;
}
#sums table tr th, #sums table tr td {
  min-width: 100px;
  padding: 8px 3px;
  text-align: right;
}
#sums table tr th {
  padding-right: 25px;
}
#sums table tr.amount-total td {
  background: #415472;
  color: white;
  font-family: Sanchez, Serif;
  font-size: 24px;
  line-height: 1em;
  padding: 7px !important;
}
#sums table tr.due-amount th, #sums table tr.due-amount td {
  font-weight: bold;
}

#terms {
  margin-top: 250px;
}
#terms > span {
  font-weight: bold;
  display: inline-block;
  min-width: 20px;
  text-transform: uppercase;
}
#terms > div {
  min-height: 50px;
  min-width: 50px;
}

.payment-info {
  font-size: 12px;
  color: gray;
  margin-top: 60px;
  float: left;
  padding: 1%;
}
.payment-info div {
  min-width: 20px;
}
.payment-info div:first-child {
  font-weight: bold;
}


  </style>


</head>
<script>

  window.print();

</script>
<body>
<page size="A4"> 


      <div class="right-invoice">
        <section id="memo">
          <div class="company-info">
            <div><b>CompuTech</b> (Pvt) Ltd</div>
            <br>
            <span>Adress: CompuTech (Pvt) Ltd Near Al Falah Bank</span>
            <br>
            <span> Railway Road Shakargarh Pakistan.</span>
            <br>
            <span>Phone: +923016138728</span>
            <br>
            <span>Email: info@computechpk.com</span>
          </div>

          <div >
            <img src="https://apps.eduportal-pk.com/EduPortal/AdminCP/Production/images/CompuTechlogo.jpg" alt="" height="130px" width="130px"style="margin-left:25%;">
          </div>
        </section>

        <section id="invoice-title-number">

          <div class="title-top">
            <span class="x-hidden"></span>
            <span>Printed: <?php echo date("d-M-Y"); ?></span> 
          </div>
        
          <div id="title">INVOICE</div>
          
        </section>

        <section id="client-info">
          <span><?php echo $branches[0]['Owner_Name'];?></span>
          <div class="client-name">
            <span><?php echo $branches[0]['Branch_Name'];?></span>
          </div>
                            
          <div>
            <span><?php echo $branches[0]['Branch_Location'];?></span>
          </div>
          
          <div>
            <span><?php echo $branches[0]['Owner_no'];?></span>
          </div>
          
          <div>
            <span><?php echo $branches[0]['Branch_Owner_Email'];?></span>
          </div>
          
         
        </section>
        
        <div class="clearfix"></div>
        
        <section id="invoice-info">
          
          <div>
            <span>Due Date:</span> <span><?php echo date("d-M-Y",strtotime($data[0]['bill_duedate']));?></span>
          </div>

          <div>
            <span>Invoice No:</span> <span id="number">0<?php echo $data[0]['bill_id']?></span>
          </div>
         
        </section>
        
        <div class="clearfix"></div>

        <div class="currency">
          <span></span> <span></span>
        </div>
        
        <section id="items">
          
          <table cellpadding="0" cellspacing="0">
          
            <tr>
              <th></th> <!-- Dummy cell for the row number and row commands -->
              <th>Description</th>
              <th>Price</th>
               <th>Total</th>
            </tr>
            
            <tr > <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              <td>Monthly Billing (<?php echo $month[0]['Month_Name']?>)</td>
              <td><?php echo number_format($data[0]['monthly_amount'])?></td>
              <td>Pkr <?php echo number_format($data[0]['monthly_amount'])?></td>
            </tr>
            
          </table>
          
        </section>

        
           <?php    if($data[0]['previous_balance']>0){?>
         <section id="items">
          
          <table cellpadding="0" cellspacing="0">
          
                       
            <tr > <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              <td style="width: 193px;">Previous Balance</td>
              <td><?php echo number_format($data[0]['previous_balance'])?></td>
              
              <td>Pkr <?php echo number_format($data[0]['previous_balance'])?></td>
            </tr>
            
          </table>
          
        </section>
          <?php } ?>
       
      <?php    if($data[0]['mask_amount']>0) {?>

        <section id="items">
          
          <table cellpadding="0" cellspacing="0">
          
                       
            <tr > <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              <td style="width: 193px;">Mask Amount</td>
              <td><?php echo number_format($data[0]['mask_amount'])?></td>
              
              <td>Pkr <?php echo number_format($data[0]['mask_amount'])?></td>
            </tr>
            
          </table>
          
        </section>
        <?php } ?>

      <?php    if($data[0]['installation_fee']>0) {?>

        <section id="items">
          
          <table cellpadding="0" cellspacing="0">
          
                       
            <tr > <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              <td style="width: 193px;">Installation Fee </td>
    
              <td><?php echo number_format($data[0]['installation_fee'])?></td>
               
              <td>Pkr <?php echo number_format($data[0]['installation_fee'])?></td>
            </tr>
            
          </table>
          
        </section>
          <?php } ?>


          <?php    if($data[0]['other_amount']>0) {?>

        <section id="items">
          
          <table cellpadding="0" cellspacing="0">
          
                       
            <tr > <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              <td style="width: 193px;"><?php if ($data[0]['other_title']!=NULL) {
              echo $data[0]['other_title']; } else { echo "Other Charges"; } ?></td>
    
              <td><?php echo number_format($data[0]['other_amount'])?></td>
               
              <td>Pkr <?php echo number_format($data[0]['other_amount'])?></td>
            </tr>
            
          </table>
          
        </section>
          <?php } ?>


    <?php    if($data[0]['discount_amount']>0) {?>

        <section id="items">
          
          <table cellpadding="0" cellspacing="0">
          
                       
            <tr> <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              
              <td></td>

              <td style="width: 193px;text-align: right;">Discount </td>
    
              <td>Pkr <?php echo number_format(0+$data[0]['discount_amount'])?></td>
            </tr>
            
          </table>
          
        </section>
      <?php  } ?>




      <?php    if($data[0]['paid_status']==1) {?>

        <section id="items">
          
          <table cellpadding="0" cellspacing="0" style="padding-top: 1%;">
          
                       
            <tr style="background-color: lightgray;"> <!-- data-iterate="item" -->
              <td></td> <!-- Don't remove this column as it's needed for the row commands -->
              
              <td></td>

              <td style="width: 193px;text-align: right;">Paid Amount </td>
    
              <td>Pkr <?php echo number_format(0+$data[0]['paid_amount'])?></td>
            </tr>
            
          </table>
          
        </section>
      <?php  } ?>

        <section id="sums">
        
          <table cellpadding="0" cellspacing="0">
      
            <tr class="amount-total">
              <!-- {amount_total_label} -->
              <td>Grand Total:  Pkr <?php echo number_format($data[0]['monthly_amount']+$data[0]['previous_balance']+$data[0]['mask_amount']+$data[0]['installation_fee']-$data[0]['discount_amount']+$data[0]['other_amount']);?></td>
            </tr>


            <tr style="background-color: #6b96d9;color:white;font-size: 25px;">
              <!-- {amount_total_label} -->
              <td>Remainings:  Pkr <?php echo number_format($data[0]['monthly_amount']+$data[0]['previous_balance']+$data[0]['mask_amount']+$data[0]['installation_fee']-$data[0]['discount_amount']+$data[0]['other_amount']-$data[0]['paid_amount']);?></td>
            </tr>

                  
          </table>
          
        </section>


        <div class="clearfix"></div>
        
          <section id="terms" style="margin-top:250px;">
       
          <div><b><?php echo $branches[0]['Branch_Name'];?> </b>, Thank you very much. We really appreciate your business. 
         
         </div>
          
        </section>

        <div class="payment-info">
          <div>Jazz Cash Account</div>
          <div>Title: Aqib Majeed</div>
          <div>Account Number: 03016138728</div>
         
        </div>


        <div class="payment-info">
          <div>Easy Paisa Account</div>
          <div>Title: Aqib Majeed</div>
          <div>Account Number: 03016138728</div>
         
        </div>


        <div class="payment-info">
          <div>Bank Al Falah</div>
          <div>Title: COMPUTECH</div>
          <div>Account Number: 02441006835833</div>  
        </div>
        
        <div class="payment-info">
          <div>HBL Account</div>
          <div>Title: Aqib Majeed</div>
          <div>Account Number: 05937900538703</div>  
        </div>


      </div>

</page>

</body>
</html>
