<link rel="stylesheet" href="css/new_mxerp.css">
<style type="text/css">

h4{margin:15px 0; padding:0;}
.tab_div{line-height: 24px; text-align: left;}
.lh24{line-height: 24px;}
.mb{margin-bottom:10px;}
.full{display: table; width: 100%; margin-bottom:10px;}
.num, .con, .chk{display: table-cell;}
.num{font-weight: 700; padding-right:10px; width:24px;}
.chk{padding-right:40px; width:12px;}
.con{width: 100%;}
.list{list-style: none; margin: 0; padding: 0;}

/*#txt-f input[type="text"]{border:0; border-bottom:#b0b0b0 1px solid; box-shadow: none;}*/
</style>
<?php 
$PageSecurity = 15;
$modid=$_REQUEST['modid'];
$frmid=$_REQUEST['frmid'];
include('cocoon_config.php');
$target_rurl="index.php?route=Account/form_gstr_3b&modid=".$modid."&frmid=".$frmid."";

$sql=DB_fetch_array(DB_query("select * from account_gstr_3b where id='".$_REQUEST['id']."'",$db));
  extract($sql);

   $month_array=array("April"=>"04","May"=>"05","June"=>"06","July"=>"07","August"=>"08","September"=>"09","October"=>"10","November"=>"11","December"=>"12");
 ?>

<div class="body_contain">
<div class="tab_div">
<div class="col-lg-1 col-md-1 col-sm-1"></div>
<div class="col-lg-10 col-md-10 col-sm-10">
	
  <div id="txt-f">
  
  <h4 class="text-center"><u>Form GSTR-3B</u></h4>
  <p class="text-center"><i>[See rule 61(5)]</i></p>
  <div class="row">
    <div class="col-sm-4 pull-right">
      <div class="full">
        <div class="col-sm-5 text-right">
            <div class="con pull-right"><strong>Year: </strong><br>
            </div>
          </div>
        <div class="col-sm-5 text-left"><select name="year" id="year" style="width:100%;">
                                           <option value="<?php echo $year; ?>"><?php echo $year; ?></option>
                                        </select> 
        </div>
      </div>
      <div class="full">
        <div class="col-sm-5 text-right">
            <div class="con pull-right"><strong>Month: </strong><br>
            </div>
          </div>
        <div class="col-sm-5 text-left"><select name="month" id="month" style="width:100%;">
                                           <option value="<?php echo $month; ?>"><?php echo array_search($month,$month_array); ?></option>
                                         </select>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-2">
            <div class="num">1.</div>
            <div class="con"><strong>GSTIN:</strong><br>
            </div>
          </div>
        <div class="col-sm-10 text-left"><input type="text" readonly name="gst_no" value="<?php echo $gst_no; ?>" readonly style="width:50%;" /></div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-4">
            <div class="num">2.</div>
            <div class="con"><strong>Legal Name of the Taxable Person:</strong></div>
          </div>
        <div class="col-sm-8 text-left"><input type="text" name="company_name" id="company_name" value="<?php echo $s->GetFieldValue('companies',"CompanyId='".$CompanyId."'",'CompanyName')  ?>" style="width:50%;" readonly /></div>
      </div>
    </div>
  </div>
  <div class="row"><div class="col-sm-12">
      <div class="full">
        <div class="col-sm-12">
            <div class="num">3.1</div>
            <div class="con"><strong>Details of Outward Supplies and inward supplies liable to reverse charge</strong></div>
        </div>
        <div class="col-sm-12">
            <div class="num">&nbsp;</div>
            <div class="con">
            <div class="full">
              <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; background:#fff;">
                <thead>
                  <tr>
                    <th>Name of Supplies</th>
                    <th width="12%">Total Taxable Value</th>
                    <th width="12%" style="text-align:center;">Integrated Tax</th>
                    <th width="12%" style="text-align:center;">Central Tax</th>
                    <th width="12%" style="text-align:center;">State/UT Tax</th>
                    <th width="12%" style="text-align:center;">Cess</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>(1)</td>
                    <td style="text-align:center;">(2)</td>
                    <td style="text-align:center;">(3)</td>
                    <td style="text-align:center;">(4)</td>
                    <td style="text-align:center;">(5)</td>
                    <td style="text-align:center;">(6)</td>
                  </tr>
                  <?php 
                       $sql_outward_supplies=DB_fetch_array(DB_query("select * from account_gstr_3b_outward_supplies where parent_id='".$_REQUEST['id']."'",$db));
 
                  ?>
                  
                  <tr>
                    <td>(a) Outward taxable supplies (other than zero rated, nil rated and exempted)</td>
                    <td style="text-align:right;"><input type="text" name="outward_supplies_without_zero_taxable" id="outward_supplies_without_zero_taxable" readonly value="<?php echo $sql_outward_supplies['os_without_zero_taxable']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="outward_supplies_without_zero_igst" id="outward_supplies_without_zero_igst" readonly value="<?php echo $sql_outward_supplies['os_without_zero_igst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="outward_supplies_without_zero_cgst" id="outward_supplies_without_zero_cgst" readonly value="<?php echo $sql_outward_supplies['os_without_zero_cgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="outward_supplies_without_zero_sgst" id="outward_supplies_without_zero_sgst" readonly value="<?php echo $sql_outward_supplies['os_without_zero_sgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="outward_supplies_without_zero_cess" id="outward_supplies_without_zero_cess" readonly value="<?php echo $sql_outward_supplies['os_without_zero_cess']; ?>" /></td>
                  </tr>
                  <tr>
                    <td>(b) Outward taxable supplies (zero rated)</td>
                    <td style="text-align:right;"><input type="text" name="outward_supplies_with_zero_taxable" id="outward_supplies_with_zero_taxable" readonly value="<?php echo $sql_outward_supplies['os_with_zero_taxable']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="outward_supplies_with_zero_igst" id="outward_supplies_with_zero_igst" readonly value="<?php echo $sql_outward_supplies['os_with_zero_igst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="outward_supplies_with_zero_cgst" id="outward_supplies_with_zero_cgst" readonly value="<?php echo $sql_outward_supplies['os_with_zero_cgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="outward_supplies_with_zero_sgst" id="outward_supplies_with_zero_sgst" readonly value="<?php echo $sql_outward_supplies['os_with_zero_sgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="outward_supplies_with_zero_cess" id="outward_supplies_with_zero_cess" readonly value="<?php echo $sql_outward_supplies['os_with_zero_cess']; ?>" /></td>
                  </tr>
                  <tr>
                    <td>(c) Other outward supplies (Nil rated, exempted)</td>
                    <td style="text-align:right;"><input type="text" name="other_outward_supplies_taxable" id="other_outward_supplies_taxable" readonly value="<?php echo $sql_outward_supplies['other_outward_supplies_taxable']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" readonly name="other_outward_supplies_igst" id="other_outward_supplies_igst" value="<?php echo $sql_outward_supplies['other_outward_supplies_igst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" readonly name="other_outward_supplies_cgst" id="other_outward_supplies_cgst" value="<?php echo $sql_outward_supplies['other_outward_supplies_cgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" readonly name="other_outward_supplies_sgst" id="other_outward_supplies_sgst" value="<?php echo $sql_outward_supplies['other_outward_supplies_sgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" readonly name="other_outward_supplies_cess" id="other_outward_supplies_cess" value="<?php echo $sql_outward_supplies['other_outward_supplies_cess']; ?>" /></td>
                  </tr>
                  <tr>
                    <td>(d) Inward supplies (liable to reverse charge)</td>
                    <td style="text-align:right;"><input type="text" name="inward_supplies_taxable" id="inward_supplies_taxable" value="<?php echo $sql_outward_supplies['inward_supplies_taxable']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="inward_supplies_igst" id="inward_supplies_igst" value="<?php echo $sql_outward_supplies['inward_supplies_igst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="inward_supplies_cgst" id="inward_supplies_cgst" value="<?php echo $sql_outward_supplies['inward_supplies_cgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="inward_supplies_sgst" id="inward_supplies_sgst" value="<?php echo $sql_outward_supplies['inward_supplies_sgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="inward_supplies_cess" id="inward_supplies_cess" value="<?php echo $sql_outward_supplies['inward_supplies_cess']; ?>" /></td>
                  </tr>
                  <tr>
                    <td>(e) Non-GST outward supplies</td>
                    
                    <td style="text-align:right;"><input type="text" name="non_gst_total_taxable" id="non_gst_total_taxable" value="<?php echo $sql_outward_supplies['non_gst_total_taxable']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="non_gst_total_igst" id="non_gst_total_igst" value="<?php echo $sql_outward_supplies['non_gst_total_igst']; ?>"/></td>
                    <td style="text-align:right;"><input type="text" name="non_gst_total_cgst" id="non_gst_total_cgst" value="<?php echo $sql_outward_supplies['non_gst_total_cgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="non_gst_total_sgst" id="non_gst_total_sgst" value="<?php echo $sql_outward_supplies['non_gst_total_sgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="non_gst_total_cess" id="non_gst_total_cess" value="<?php echo $sql_outward_supplies['non_gst_total_cess']; ?>"/></td>
                  </tr>
                </tbody>
              </table>
            </div>
            </div>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-12">
            <div class="num">3.2</div>
            <div class="con"><strong>of the supplies shown in 3.1(a) above, details of inter-State supplies made to unregistered persons, composition taxable persona and UIN holders</strong></div>
        </div>
        <div class="col-sm-12">
            <div class="num">&nbsp;</div>
            <div class="con">
            <div class="full">
              <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; background:#fff;">
                <thead>
                  <tr>
                    <th></th>
                    <th width="18%" style="text-align:center;">Place of Supply (State/UT)</th>
                    <th width="18%" style="text-align:center;">Total Taxable Value</th>
                    <th width="18%" style="text-align:center;">Amount of Integrated Tax</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>(1)</td>
                    <td style="text-align:center;">(2)</td>
                    <td style="text-align:center;">(3)</td>
                    <td style="text-align:center;">(4)</td>
                  </tr>
                  <?php 
                      $sql_unreg=DB_fetch_array(DB_query("select * from account_gstr_3b_unregistered where parent_id='".$_REQUEST['id']."'",$db));

                  ?>
                  <tr>
                    <td>(a) Supplies made to Unrecognised Persons</td>
                    <td style="text-align:right;"><input type="text" readonly name="supplies_unrecognised_sgst" id="supplies_unrecognised_sgst" style="width:100%;" value="<?php echo $sql_unreg['unrecognised_sgst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="supplies_unrecognised_total_taxable" id="supplies_unrecognised_total_taxable" readonly style="width:100%;" value="<?php echo $sql_unreg['unrecognised_total_taxable']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="supplies_unrecognised_igst" readonly id="supplies_unrecognised_igst" style="width:100%;" value="<?php echo $sql_unreg['unrecognised_igst']; ?>"></td>
                  </tr>
                  <tr>
                    <td>(b) Supplies made to Composition Taxable Persons</td>
                     <td style="text-align:right;"><input type="text" name="supplies_compostion_taxable_sgst" id="supplies_compostion_taxable_sgst" readonly style="width:100%;" value="<?php echo $sql_unreg['taxable_sgst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="supplies_compostion_total_taxable" id="supplies_compostion_total_taxable" readonly style="width:100%;" value="<?php echo $sql_unreg['total_taxable']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="supplies_compostion_total_igst" id="supplies_compostion_total_igst" readonly style="width:100%;" value="<?php echo $sql_unreg['total_igst']; ?>"></td>
                  </tr>
                  <tr>
                    <td>(c) Supplies made to UIN Holders</td>
                     <td style="text-align:right;"><input type="text" name="supplies_compostion_uin_sgst" id="supplies_compostion_uin_sgst" readonly style="width:100%;" value="<?php echo $sql_unreg['uin_sgst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="supplies_compostion_uin_total_taxable" id="supplies_compostion_uin_total_taxable" readonly style="width:100%;" value="<?php echo $sql_unreg['uin_total_taxable']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="supplies_compostion_uin_igst" id="supplies_compostion_uin_igst" style="width:100%;" readonly value="<?php echo $sql_unreg['uin_igst']; ?>"></td>
                  </tr>
                </tbody>
              </table>
            </div>
            </div>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-12">
            <div class="num">4. </div>
            <div class="con"><strong>Eligible ITC</strong></div>
        </div>
        <div class="col-sm-12">
            <div class="num">&nbsp;</div>
            <div class="con">
            <div class="full">
              <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; background:#fff;">
                <thead>
                  <tr>
                    <th style="text-align:center;">Details</th>
                    <th style="text-align:center;">Integrated Tax</th>
                    <th style="text-align:center;">Central Tax</th>
                    <th colspan="2" style="text-align:center;">State/UT Tax</th>
                    <th width="9%" style="text-align:center;">Cess</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>(1)</td>
                    <td style="text-align:center;">(2)</td>
                    <td style="text-align:center;">(3)</td>
                    <td style="text-align:center;">(4)</td>
                    <td style="text-align:center;">(5)</td>
                    <td style="text-align:center;">(6)</td>
                  </tr>
                  <tr>
                    <td><strong>(A) ITC available (whether in full or part)</strong></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                  <?php 
                    $sql_itc=DB_fetch_array(DB_query("select * from account_gstr_3b_itc where parent_id='".$_REQUEST['id']."'",$db));    

                  ?>
                  <tr>
                    <td style="padding-left:20px;">(1) Import of goods</td>
                    <td style="text-align:right;"><input type="text" name="itc_import_goods_igst" style="width:50%;" id="itc_import_goods_igst" readonly value="<?php echo $sql_itc['goods_igst']; $a2_sum[]=$sql_itc['goods_igst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="itc_import_goods_cgst" style="width:50%;" id="itc_import_goods_cgst" readonly value="<?php echo $sql_itc['goods_cgst']; $a3_sum[]=$sql_itc['goods_cgst']; ?>"  /></td>
                   <td style="text-align:right;"><input type="text" name="itc_import_goods_sgst" style="width:50%;" id="itc_import_goods_sgst" readonly value="<?php echo $sql_itc['goods_sgst']; $a4_sum[]=$sql_itc['goods_sgst']; ?>" ></td>
                    <td style="text-align:right;"><input type="text" name="itc_import_goods_utgst" style="width:50%;" id="itc_import_goods_utgst" readonly value="<?php echo $sql_itc['goods_utgst']; $a5_sum[]=$sql_itc['goods_utgst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="itc_import_goods_cess" style="width:50%;" id="itc_import_goods_cess" readonly value="<?php echo $sql_itc['goods_cess']; $a6_sum[]=$sql_itc['goods_cess']; ?>"></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(2) Import of services</td>
                  <td style="text-align:right;"><input type="text" name="itc_import_services_igst" style="width:50%;" id="itc_import_services_igst" readonly value="<?php echo $sql_itc['services_igst']; $a2_sum[]=$sql_itc['services_igst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="itc_import_services_cgst" style="width:50%;" id="itc_import_services_cgst" readonly value="<?php echo $sql_itc['services_cgst']; $a3_sum[]=$sql_itc['services_cgst']; ?>"></td>
                   <td style="text-align:right;"><input type="text" name="itc_import_services_sgst" style="width:50%;" id="itc_import_services_sgst" readonly value="<?php echo $sql_itc['services_sgst']; $a4_sum[]=$sql_itc['services_sgst'];  ?>"></td>
                    <td style="text-align:right;"><input type="text" name="itc_import_services_utgst" style="width:50%;" id="itc_import_services_utgst" readonly value="<?php echo $sql_itc['services_utgst']; $a5_sum[]=$sql_itc['goods_utgst']; ?>"></td>
                    <td style="text-align:right;"><input type="text" name="itc_import_services_cess" style="width:50%;" id="itc_import_goods_cess" readonly value="<?php echo $sql_itc['services_cess']; $a6_sum[]=$sql_itc['services_cess']; ?>"></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(3) Inward supplies liable to reverse charge (other than 1 &amp; 2 above)</td>
                    <td style="text-align:right;"><input type="text" name="itc_reverse_charge_igst" style="width:50%;" id="itc_reverse_charge_igst" readonly value="<?php echo $sql_itc['reverse_charge_igst'];  $a2_sum[]=$sql_itc['reverse_charge_igst']; ?>"></td>
                       <td style="text-align:right;"><input type="text" name="itc_reverse_charge_cgst" style="width:50%;" id="itc_reverse_charge_cgst" readonly value="<?php echo $sql_itc['reverse_charge_cgst']; $a3_sum[]=$sql_itc['reverse_charge_cgst']; ?>" ></td>
                     <td style="text-align:right;"><input type="text" name="itc_reverse_charge_sgst" style="width:50%;" id="itc_reverse_charge_sgst" readonly value="<?php echo $sql_itc['reverse_charge_sgst']; $a4_sum[]=$sql_itc['reverse_charge_sgst']; ?>"></td>
                       <td style="text-align:right;"><input type="text" name="itc_reverse_charge_utgst" style="width:50%;" id="itc_reverse_charge_utgst" readonly value="<?php echo $sql_itc['reverse_charge_utgst']; $a5_sum[]=$sql_itc['reverse_charge_utgst']; ?>"></td>
                      <td style="text-align:right;"><input type="text" name="itc_reverse_charge_cess" style="width:50%;" id="itc_reverse_charge_cess" readonly value="<?php echo $sql_itc['reverse_charge_cess']; $a6_sum[]=$sql_itc['reverse_charge_cess']; ?>"></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(4) Inward supplies from ISD</td>
                    <td style="text-align:right;"><input type="text" name="itc_inward_supplies_isd_igst" style="width:50%;" id="itc_inward_supplies_isd_igst" readonly value="<?php echo $sql_itc['isd_igst']; $a2_sum[]=$sql_itc['isd_igst']; ?>"></td>
                       <td style="text-align:right;"><input type="text" name="itc_inward_supplies_isd_cgst" style="width:50%;" id="itc_inward_supplies_isd_cgst" readonly value="<?php echo $sql_itc['isd_cgst']; $a3_sum[]=$sql_itc['isd_cgst']; ?>"></td>
                     <td style="text-align:right;"><input type="text" name="itc_inward_supplies_isd_sgst" style="width:50%;" id="itc_inward_supplies_isd_sgst" readonly value="<?php echo $sql_itc['isd_sgst']; $a4_sum[]=$sql_itc['isd_sgst']; ?>"></td>
                       <td style="text-align:right;"><input type="text" name="itc_inward_supplies_isd_ugst" style="width:50%;" id="itc_inward_supplies_isd_ugst" readonly value="<?php echo $sql_itc['isd_ugst']; $a5_sum[]=$sql_itc['isd_ugst']; ?>"></td>
                      <td style="text-align:right;"><input type="text" name="itc_inward_supplies_isd_cess" style="width:50%;" id="itc_inward_supplies_isd_cess" readonly value="<?php echo $sql_itc['isd_cess']; $a6_sum[]=$sql_itc['isd_cess']; ?>"></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(5) All other ISD</td>
                     <td style="text-align:right;"><input type="text" name="itc_inward_supplies_other_isd_igst" style="width:50%;" id="itc_inward_supplies_other_isd_igst" readonly value="<?php echo $sql_itc['other_isd_igst']; $a2_sum[]=$sql_itc['other_isd_igst']; ?>"></td>
                       <td style="text-align:right;"><input type="text" name="itc_inward_supplies_other_isd_cgst" style="width:50%;" id="itc_inward_supplies_other_isd_cgst" readonly value="<?php echo $sql_itc['other_isd_cgst']; $a3_sum[]=$sql_itc['other_isd_cgst']; ?>"></td>
                     <td style="text-align:right;"><input type="text" name="itc_inward_supplies_other_isd_sgst" style="width:50%;" id="itc_inward_supplies_other_isd_sgst" readonly value="<?php echo $sql_itc['other_isd_sgst']; $a4_sum[]=$sql_itc['other_isd_sgst']; ?>"></td>
                       <td style="text-align:right;"><input type="text" name="itc_inward_supplies_other_isd_ugst" style="width:50%;" id="itc_inward_supplies_other_isd_ugst" readonly value="<?php echo $sql_itc['other_isd_ugst']; $a5_sum[]=$sql_itc['other_isd_ugst']; ?>"></td>
                      <td style="text-align:right;"><input type="text" name="itc_inward_supplies_other_isd_cess" style="width:50%;" id="itc_inward_supplies_other_isd_cess" readonly value="<?php echo $sql_itc['other_isd_cess']; $a6_sum[]=$sql_itc['other_isd_cess']; ?>"></td>
                  </tr>
                  <tr>
                    <td><strong>(B) ITC Reversed</strong></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(1) As per rules 42 &amp; 43 of CGST Rules</td>
                    <td style="text-align:right;"><input type="text" name="itc_reserved_igst" id="itc_reserved_igst" style="width:50%;"  readonly value="<?php echo $sql_itc['itc_reserved_igst']; $b2_sum[]=$sql_itc['itc_reserved_igst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="itc_reserved_cgst" id="itc_reserved_cgst" style="width:50%;" readonly value="<?php echo $sql_itc['itc_reserved_cgst']; $b3_sum[]=$sql_itc['itc_reserved_cgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="itc_reserved_sgst" id="itc_reserved_sgst" style="width:50%;" readonly value="<?php echo $sql_itc['itc_reserved_sgst']; $b4_sum[]=$sql_itc['itc_reserved_sgst']; ?>" /></td>
                     <td style="text-align:right;"><input type="text" name="itc_reserved_utgst" id="itc_reserved_utgst" style="width:50%;" readonly value="<?php echo $sql_itc['itc_reserved_utgst']; $b5_sum[]=$sql_itc['itc_reserved_utgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="itc_reserved_cess" id="itc_reserved_cess" style="width:50%;" readonly value="<?php echo $sql_itc['itc_reserved_cess']; $b6_sum[]=$sql_itc['itc_reserved_cess'];?>" /></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(2) Others</td>
                   <td style="text-align:right;"><input type="text" name="itc_reserved_other_igst" id="itc_reserved_other_igst" style="width:50%;" readonly value="<?php echo $sql_itc['reserved_other_igst']; $b2_sum[]=$sql_itc['reserved_other_igst'];  ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="itc_reserved_other_cgst" id="itc_reserved_other_cgst" style="width:50%;" readonly value="<?php echo $sql_itc['reserved_other_cgst']; $b3_sum[]=$sql_itc['reserved_other_cgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="itc_reserved_other_sgst" id="itc_reserved_other_sgst" style="width:50%;" readonly value="<?php echo $sql_itc['reserved_other_sgst']; $b4_sum[]=$sql_itc['reserved_other_sgst']; ?>" /></td>
                     <td style="text-align:right;"><input type="text" name="itc_reserved_other_utgst" id="itc_reserved_other_utgst" style="width:50%;" readonly value="<?php echo $sql_itc['reserved_other_utgst']; $b5_sum[]=$sql_itc['reserved_other_utgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="itc_reserved_other_cess" id="itc_reserved_other_cess" style="width:50%;" readonly value="<?php echo $sql_itc['reserved_other_cess']; $b6_sum[]=$sql_itc['reserved_other_cess']; ?>" /></td>
                  </tr>
                  <?php 
                          $a2_total=array_sum($a2_sum);
                          $a3_total=array_sum($a3_sum);
                          $a4_total=array_sum($a4_sum);
                          $a5_total=array_sum($a5_sum);
                          $a6_total=array_sum($a6_sum);
                          
                          $b2_total=array_sum($b2_sum);
                          $b3_total=array_sum($b3_sum);
                          $b4_total=array_sum($b4_sum);
                          $b5_total=array_sum($b5_sum);
                          $b6_total=array_sum($b6_sum);
                        

                          if(empty($a2_total)) { $a2_total=0;}
                          if(empty($a3_total)) { $a3_total=0;}
                          if(empty($a4_total)) { $a4_total=0;}
                          if(empty($a5_total)) { $a5_total=0;}
                          if(empty($a6_total)) { $a6_total=0;}

                          if(empty($b2_total)) { $b2_total=0;}
                          if(empty($b3_total)) { $b3_total=0;}
                          if(empty($b4_total)) { $b4_total=0;}
                          if(empty($b5_total)) { $b5_total=0;}
                          if(empty($b6_total)) { $b6_total=0;}
                        





                  ?>
                  <tr>
                    <td><strong>(C) Net ITC available (A)-(B)</strong></td>
                     <td style="text-align:right;"><input type="text" name="itc_available_igst" id="itc_available_igst" style="width:50%;" readonly value="<?php echo number_format((float)$a2_total-$b2_total,3);   ?>" /></td>
                      <td style="text-align:right;"><input type="text" name="itc_available_cgst" id="itc_available_cgst" style="width:50%;" readonly value="<?php echo number_format((float)$a3_total-$b3_total,3);   ?>" /></td>
                      <td style="text-align:right;"><input type="text" name="itc_available_sgst" id="itc_available_sgst" style="width:50%;" readonly value="<?php echo number_format((float)$a4_total-$b4_total,3);   ?>" /></td>
                      <td style="text-align:right;"><input type="text" name="itc_available_ugst" id="itc_available_ugst" style="width:50%;" readonly value="<?php echo number_format((float)$a5_total-$b5_total,3);   ?>" /></td>
                      <td style="text-align:right;"><input type="text" name="itc_available_cess" id="itc_available_ugst" style="width:50%;" readonly value="<?php echo number_Format((float)$a6_total-$b6_total,3);   ?>" /></td>
                  </tr>
                  <tr>
                    <td><strong>(D) Ineligible ITC</strong></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(1) As per Section 17(5)</td>
                   <td style="text-align:right;"><input type="text" name="ineligble_itc_igst" id="ineligble_itc_igst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_igst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_cgst" id="ineligble_itc_cgst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_cgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="ineligble_itc_sgst" id="ineligble_itc_sgst" style="width:50%;"  readonly value="<?php echo $sql_itc['ineligble_itc_sgst']; ?>"/></td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_ugst" id="ineligble_itc_ugst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_ugst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_cess" id="ineligble_itc_cess" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_cess']; ?>" /></td>
                  </tr>
                  <tr>
                    <td style="padding-left:20px;">(2) Others</td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_other_igst" id="ineligble_itc_other_igst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_other_igst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_other_cgst" id="ineligble_itc_other_cgst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_other_cgst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="ineligble_itc_other_sgst" id="ineligble_itc_other_sgst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_other_sgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_other_ugst" id="ineligble_itc_other_ugst" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_other_ugst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="ineligble_itc_other_cess" id="ineligble_itc_other_cess" style="width:50%;" readonly value="<?php echo $sql_itc['ineligble_itc_other_cess']; ?>" /></td>
                  </tr>
                </tbody>
              </table>
            </div>
            </div>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-12">
            <div class="num">5.</div>
            <div class="con"><strong>Value of exempt, nil rated and non-GST inward supplies</strong></div>
        </div>
        <div class="col-sm-12">
            <div class="num">&nbsp;</div>
            <div class="con">
            <div class="full">
              <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; background:#fff;">
                <thead>
                  <tr>
                    <th style="text-align:center;">Nature of Supplies</th>
                    <th style="text-align:center;">Inter-State Supplies</th>
                    <th style="text-align:center;">Intra-State Supplies</th>
                  </tr>
                </thead>
                <tbody>
                <?php 
                  $sql_comp=DB_fetch_array(DB_query("select * from account_gstr_3b_inward_supplies where parent_id='".$_REQUEST['id']."'",$db));

                ?>
                  <tr>
                    <td>(1)</td>
                    <td style="text-align:center;">(2)</td>
                    <td style="text-align:center;">(3)</td>
                  </tr>
                  <tr>
                    <td>From a supplier under composition scheme, Exempt and Nil rated</td>
                    <td style="text-align:right;"><input type="text" name="non_gst_under_composition_inter_state" id="non_gst_under_composition_inter_state" readonly value="<?php echo $sql_comp['composition_inter_state']; ?>" /></td>
                     <td style="text-align:right;"><input type="text" name="non_gst_under_composition_intra_state" id="non_gst_under_composition_intra_state" readonly value="<?php echo $sql_comp['composition_intra_state']; ?>" /></td>
                  </tr>
                  <tr>
                    <td>Supply</td>
                     <td style="text-align:right;"><input type="text" name="supply_inter_state" id="supply_inter_state" value="<?php echo $sql_comp['supply_inter_state']; ?>" readonly /></td>
                     <td style="text-align:right;"><input type="text" name="supply_intra_state" id="supply_intra_state" value="<?php echo $sql_comp['supply_intra_state']; ?>" readonly /></td>
                  </tr>
                  <tr>
                    <td>Non GST supply</td>
                    <td style="text-align:right;"><input type="text" name="non_gst_supply_inter_state" id="non_gst_supply_inter_state" value="<?php echo $sql_comp['non_gst_supply_inter_state']; ?>" readonly /></td>
                     <td style="text-align:right;"><input type="text" name="non_gst_supply_intra_state" id="non_gst_supply_intra_state" value="<?php echo $sql_comp['non_gst_supply_intra_state']; ?>" readonly /></td>
                  </tr>
                </tbody>
              </table>
            </div>
            </div>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-12">
            <div class="num">6.1</div>
            <div class="con"><strong>Payment of Tax</strong></div>
        </div>
        <div class="col-sm-12">
            <div class="num">&nbsp;</div>
            <div class="con">
            <div class="full">
              <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; background:#fff;">
                <thead>
                 <?php 
                        $sql_payment=DB_fetch_array(DB_query("select * from account_gstr_3b_payment_tax where parent_id='".$_REQUEST['id']."'",$db));
                ?>
                  <tr>
                    <th style="text-align:center;" rowspan="2">Description</th>
                    <th width="9%" style="text-align:center;" rowspan="2">Tax Payable</th>
                    <th colspan="4" style="text-align:center;">Paid through ITC</th>
                    <th width="9%" style="text-align:center;" rowspan="2">Tax paid TDS/TCS</th>
                    <th width="9%" rowspan="2" style="text-align:center;">Tax/Cess paid in cash</th>
                    <th width="9%" rowspan="2" style="text-align:center;">Interest</th>
                    <th width="9%" rowspan="2" style="text-align:center;">Late Fee</th>
                  </tr>
                  <tr>
                    <th width="6%">Integrated Tax</th>
                    <th width="6%">Central Tax</th>
                    <th width="6%">State/UT Tax</th>
                    <th width="6%">Cess</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>(1)</td>
                    <td style="text-align:center;">(2)</td>
                    <td style="text-align:center;">(3)</td>
                    <td style="text-align:center;">(4)</td>
                    <td style="text-align:center;">(5)</td>
                    <td style="text-align:center;">(6)</td>
                    <td style="text-align:center;">(7)</td>
                    <td style="text-align:center;">(8)</td>
                    <td style="text-align:center;">(9)</td>
                    <td style="text-align:center;">(10)</td>
                  </tr>
                  <tr>
                    <td>Integrated Tax</td>
                    <td style="text-align:right;"><input type="text" readonly name="payment_tax_igst_total_pay" id="payment_tax_igst_total_pay" value="<?php echo $sql_payment['igst_total_pay']; ?>"  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_igst" readonly id="payment_tax_igst_total_igst"   value="<?php echo $sql_payment['igst_total_igst']; ?>" /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_cgst" readonly id="payment_tax_igst_total_cgst"  value="<?php echo $sql_payment['igst_total_cgst']; ?>" /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_sgst" readonly id="payment_tax_igst_total_sgst" value="<?php echo $sql_payment['igst_total_sgst']; ?>"  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_cess" readonly id="payment_tax_igst_total_cess" value="<?php echo $sql_payment['igst_total_cess']; ?>"  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_tax_paid" id="payment_tax_igst_total_tax_paid" readonly value="<?php echo $sql_payment['igst_total_tax_paid']; ?>" /></td>
                  <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_tax_paid_cash" readonly id="payment_tax_igst_total_tax_paid_cash" value="<?php echo $sql_payment['igst_total_tax_paid_cash']; ?>"  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_interest" id="payment_tax_igst_total_interest" value="<?php echo $sql_payment['igst_total_interest']; ?>" readonly  /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_igst_total_late" id="payment_tax_igst_total_late" value="<?php echo $sql_payment['igst_total_late']; ?>" readonly  /></td>
                  </tr>
                  <tr>
                    <td>Central Tax</td>
                      <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_pay" id="payment_tax_cgst_total_pay" value="<?php echo $sql_payment['cgst_total_pay']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_igst" id="payment_tax_cgst_total_igst" value="<?php echo $sql_payment['cgst_total_igst']; ?>" readonly /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_cgst" id="payment_tax_cgst_total_cgst" value="<?php echo $sql_payment['cgst_total_cgst']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_sgst" id="payment_tax_cgst_total_sgst" value="<?php echo $sql_payment['cgst_total_sgst']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_cess" id="payment_tax_cgst_total_cess" value="<?php echo $sql_payment['cgst_total_cess']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_tax_paid" id="payment_tax_cgst_total_tax_paid" value="<?php echo $sql_payment['cgst_total_tax_paid']; ?>" readonly /></td>
                  <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_tax_paid_cash" id="payment_tax_cgst_total_tax_paid_cash" value="<?php echo $sql_payment['cgst_total_tax_paid_cash']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_interest" id="payment_tax_cgst_total_interest" value="<?php echo $sql_payment['cgst_total_interest']; ?>" readonly /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_cgst_total_late" id="payment_tax_cgst_total_late" value="<?php echo $sql_payment['cgst_total_late']; ?>" readonly  /></td>
                  </tr>
                  <tr>
                    <td>State/UT Tax</td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_pay" id="payment_tax_sgst_total_pay"  value="<?php echo $sql_payment['sgst_total_pay']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_igst" id="payment_tax_sgst_total_igst" value="<?php echo $sql_payment['sgst_total_igst']; ?>" readonly /></td>
                   <td style="text-align:right;"><input type="text"  name="payment_tax_sgst_total_cgst" id="payment_tax_sgst_total_cgst" value="<?php echo $sql_payment['sgst_total_cgst']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_sgst" id="payment_tax_sgst_total_sgst" value="<?php echo $sql_payment['sgst_total_sgst']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_cess" id="payment_tax_sgst_total_cess" value="<?php echo $sql_payment['sgst_total_cess']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_tax_paid" id="payment_tax_sgst_total_tax_paid" value="<?php echo $sql_payment['sgst_total_tax_paid']; ?>" readonly  /></td>
                  <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_tax_paid_cash" id="payment_tax_sgst_total_tax_paid_cash" value="<?php echo $sql_payment['sgst_total_tax_paid_cash']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_interest" id="payment_tax_sgst_total_interest" value="<?php echo $sql_payment['sgst_total_interest']; ?>" readonly /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_sgst_total_late" id="payment_tax_sgst_total_late"  value="<?php echo $sql_payment['sgst_total_late']; ?>" readonly/></td>
                  </tr>
                  <tr>
                    <td>Cess</td>
                       <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_pay" id="payment_tax_cess_total_pay" value="<?php echo $sql_payment['cess_total_pay']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_igst" id="payment_tax_cess_total_igst" value="<?php echo $sql_payment['cess_total_igst']; ?>" readonly /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_cgst" id="payment_tax_cess_total_cgst" value="<?php echo $sql_payment['cess_total_cgst']; ?>" readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_sgst" id="payment_tax_cess_total_sgst" value="<?php echo $sql_payment['cess_total_sgst']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_cess" id="payment_tax_cess_total_cess" value="<?php echo $sql_payment['cess_total_cess']; ?>" readonly  /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_tax_paid" id="payment_tax_cess_total_tax_paid" value="<?php echo $sql_payment['cess_total_tax_paid']; ?>" readonly /></td>
                  <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_tax_paid_cash" id="payment_tax_cess_total_tax_paid_cash" value="<?php echo $sql_payment['cess_total_tax_paid_cash']; ?>"  readonly /></td>
                    <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_interest" id="payment_tax_cess_total_interest" value="<?php echo $sql_payment['cess_total_interest']; ?>"  readonly /></td>
                   <td style="text-align:right;"><input type="text" name="payment_tax_cess_total_late" id="payment_tax_cess_total_late" value="<?php echo $sql_payment['cess_total_late']; ?>"  readonly /></td>
                  </tr>
                </tbody>
              </table>
            </div>
            </div>
        </div>
      </div>
    </div>
  </div>
  <div class="row">
    <div class="col-sm-12">
      <div class="full">
        <div class="col-sm-12">
            <div class="num">6.2</div>
            <div class="con"><strong>TDS/TCS Credit</strong></div>
        </div>
        <div class="col-sm-12">
            <div class="num">&nbsp;</div>
            <div class="con">
            <div class="full">
              <table width="100%" border="1" cellpadding="3" cellspacing="0" style="border:#808080 1px solid; background:#fff;">
                <thead>
                  <tr>
                    <th style="text-align:center;">Details</th>
                    <th width="18%" style="text-align:center;">Intergrated Tax</th>
                    <th width="18%" style="text-align:center;">Central Tax</th>
                    <th width="18%" style="text-align:center;">State/UT Tax</th>
                  </tr>
                </thead>
                <?php 
                        $sql_gstr_tds=DB_fetch_array(DB_query("select * from account_gstr_3b_tds where parent_id='".$_REQUEST['id']."'",$db));
                ?>
                <tbody>
                  <tr>
                    <td>(1)</td>
                    <td style="text-align:center;">(2)</td>
                    <td style="text-align:center;">(3)</td>
                    <td style="text-align:center;">(4)</td>
                  </tr>
                  <tr>
                    <td>TDS</td>
                    <td style="text-align:right;"><input name="tds_igst" id="tds_igst" type="text" readonly style="width:100%;" value="<?php echo $sql_gstr_tds['tds_igst']; ?>"   /></td>
                    <td style="text-align:right;"><input name="tds_cgst" id="tds_cgst" type="text" readonly  style="width:100%;" value="<?php echo $sql_gstr_tds['tds_cgst']; ?>"   /></td>
                    <td style="text-align:right;"><input name="tds_sgst" id="tds_sgst" type="text" readonly style="width:100%;" value="<?php echo $sql_gstr_tds['tds_sgst']; ?>"  /></td>
                  </tr>
                  <tr>
                    <td>TCS</td>
                    <td style="text-align:right;"><input name="tcs_igst" id="tcs_igst" type="text" readonly style="width:100%;" value="<?php echo $sql_gstr_tds['tcs_igst']; ?>"   /></td>
                    <td style="text-align:right;"><input name="tcs_cgst" id="tcs_cgst" type="text" readonly value="<?php echo $sql_gstr_tds['tcs_cgst']; ?>" style="width:100%;"   /></td>
                    <td style="text-align:right;"><input name="tcs_sgst" id="tcs_sgst" type="text" readonly style="width:100%;"  value="<?php echo $sql_gstr_tds['tcs_sgst']; ?> " /></td>
                  </tr>


                </tbody>
              </table>

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


</div>
<div class="col-lg-1 col-md-1 col-sm-1"></div>
</div>
    </div>

