<style type="text/css">
    .amount{
        text-align: right !important;
    }

    .quantity {
        text-align: center !important;
    }

    .btn-group button {
        height:30px; }

    #content .wrap #grid_content_1 .row-fluid.scRow .row-fluid.scRow .span12.scCol #grid_block_5 .content.np #listDetails tbody #trInfos td .row-fluid .controls-row .span3 {
        font-size: 11px;
        color: #000;
        font-weight: bold;
    }
    .test {
        font-size: 10px;
    }
    .span3 {
        font-size: 10px;
    }
    tbody {
        font-size: 10px;
    }
    #content .wrap #grid_content_1 .row-fluid.scRow .row-fluid.scRow .span12.scCol #grid_block_6 .content.np #listCharge tbody #trInfosCharge td .row-fluid .controls-row .span3 {
        font-weight: bold;
    }
</style>

<script type="application/javascript">
       $(document).ready(function(){
     jQuery('.datepicker2').datepicker({
                        dateFormat : 'dd-mm-yy',
                        changeMonth : true,
                        changeYear : true
                });
            });
                
    function saveGstReport(){
        if ( $("#gstRptForm").validationEngine("validate")){
            $("#btnsaveGstReport").attr("disabled","disabled");
         $.ajax({
            type: "POST",
            data : {
                ammendment :$("#ammendment").val(),
                A1:  $("#A1").val(),
                A2:  $("#A2").val(),  
                
                B3a:  $("#B3a").val(),
                B3b:  $("#B3b").val(),
                B4:  $("#B4").val(),
                B9:  $("#B9").val(),
                
                C19a1:  $("#C19a1").val(),
                C19a2:  accounting.unformat($("#C19a2").val()),
                  C19b1:  $("#C19b1").val(),
                  C19b2:  accounting.unformat($("#C19b2").val()),
                C19c1:  $("#C19c1").val(),
                C19c2:  accounting.unformat($("#C19c2").val()),
                C19d1:  $("#C19d1").val(),
                  C19d2:  accounting.unformat($("#C19d2").val()),
                  C19e1:  $("#C19e1").val(),
                  C19e2:  accounting.unformat($("#C19e2").val()),
                 
                  C19f:  accounting.unformat($("#C19f").val()),
                  C19g:  accounting.unformat($("#C19g").val()),
                  
                  D20:  $("#D20").val(),
                  D21a:  $("#D21a").val(),
                  D21b:  $("#D21b").val(),
                  D22:  $("#D22").val(),
                  D23:  $("#D23").val(),
                  D24:  $("#D24").val(),
                  
            },
            url: "<?php echo base_url() ?>gst03/saveGstRpt",
            success: function(data) {
              window.location = "<?php echo base_url()?>gst03"
            }
      });
      }
    }
    
    function calculatePercentage(me){ 
    n = accounting.unformat($(me).val())*100/accounting.unformat($("#C19g").val());
    if (n<=100)
        $(me).parent().parent().find("td").eq(2).find("input").val(accounting.formatNumber(n,3));
    else{
        $(me).parent().parent().find("td").eq(2).find("input").val("");
        $(me).val("");
      }
    }
    
    function updateOthers(me){
         var amount =0;
         for (i=0; i<5; i++) {
                       amount +=  accounting.unformat($('#tableC19 > tbody > tr:eq(' + i + ') > td:eq(1)').find("input").val()); 
                        
         }
         //$("#totalamount").val(accounting.formatNumber(totalAmount + totalAmountCharge,2) );C19fTax
         
         C19f = accounting.unformat($("#C19g").val()) - amount;
         n = C19f*100 / accounting.unformat($("#C19g").val());
         
         if(n<0 || n>100){
             $(me).val("");
             $(me).parent().parent().find("td").eq(2).find("input").val("");
         }else{
            $("#C19f").val(accounting.formatNumber(C19f,3));
            $("#C19fTax").val(accounting.formatNumber(n,3));
        }
    }
    
    
</script>



<div id="content"> 
    <div class="wrap">
        <div class="head">
            <div class="info">
                <!--<h1><?php echo element('compName', $this->session->userdata('logged_in')) ?> [ 
                    <?php echo element('compNo', $this->session->userdata('logged_in')) ?> ]</h1>-->
                <ul class="breadcrumb">
                    <li><a href='<?php echo base_url() . "home" ?>'><?php echo $this->lang->line('dashboard') ?></a> <span class="divider">-</span></li>
                    <li><a href='<?php echo base_url() . "AccountPayables/home" ?>'> <?php echo $this->lang->line('module') ?></a> <span class="divider">-</span></li>
                    <li class="active"><?php echo $this->lang->line('title') ?></li>
                </ul>
            </div>

            <div class="search">
                <form action="<?php echo base_url() ?>admin/search" method="post">
                    <input name="search_text" type="text" placeholder="search..."/>                                
                    <button type="submit"><span class="i-magnifier"></span></button>
                </form>
            </div>        

        </div><!-- head --> 
        <div class="content" id="grid_content_1">
            <form id="gstRptForm" name="gstRptForm" action="#">    
                <input type="hidden" value="null" id="saleInvoiceId" />

                <div class="block">
                    <div class="head">
                        <h2><strong><?php echo $this->lang->line('title') ?></strong></h2>
                    </div><!-- head -->
                    <div class="content">

                        <fieldset>
                            <legend>
                                <?php echo $this->lang->line('notaPenting') ?>
                            </legend>
                            <ul>
                                <li>
                                    1) <?php echo $this->lang->line('line1') ?>
                                </li>
                                <li>
                                    2) <?php echo $this->lang->line('line2') ?>
                                </li>
                                <li>
                                    3) <?php echo $this->lang->line('line3') ?>
                                </li>
                                <li>
                                    4) <?php echo $this->lang->line('line4') ?>
                                </li>
                                <li>
                                    5) <?php echo $this->lang->line('line5') ?>
                                </li>
                                <li>
                                    6) <?php echo $this->lang->line('line6') ?>
                                </li>
                            </ul>
                        </fieldset>
                    </div><!-- row-fluid scRow-->
                </div><!-- row-fluid scRow-->

                <div class="row-fluid scRow"> 
                    <div class="span12 scCol">
                        <div class="block" id="grid_block_4">
                            <div class="footer">
                                <?php echo $this->lang->line('amendment') ?>
                                <select class="validate[required]" id="ammendment" style="width:120px;">
                                            <option></option>
                                            <option value="1"><?php echo $this->lang->line('yes'); ?></option>
                                            <option value="0"><?php echo $this->lang->line('no'); ?></option>
                                        </select>
                            </div><!-- footer -->       
                        </div><!-- grid block 1-->
                    </div><!-- scCol -->   

                </div><!-- grid 1 -->


                <div class="row-fluid scRow">                            
                    <div class="span12 scCol">
                        <div class="block" id="grid_block_4">
                            <div class="head">
                                <h2><?php echo $this->lang->line('partA') ?></h2>
                                <ul class="buttons">
                                    <li><a class="block_toggle collapsed" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                                            <span class="i-arrow-down-3"></span></a></li>
                                </ul>                                        
                            </div><!-- head -->
                            <div class="content np">
                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('gstNo') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "A1", "value" =>$A1, "readonly" => "readonly", 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('A1'));
                                        ?>
                                    </div>
                                </div>
                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('companyName') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "A2","value" =>$A2,  "readonly" => "readonly", 'class' => 'span12');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>   
                                    </div> 
                                </div>

                            </div><!-- content -->
                        </div><!-- grid block 1-->
                    </div><!-- scCol -->
                </div><!-- row-fluid scRow-->

                <div class="row-fluid scRow">                            
                    <div class="span12 scCol">
                        <div class="block" id="grid_block_4">
                            <div class="head">
                                <h2><?php echo $this->lang->line('partB') ?></h2>
                                <ul class="buttons">
                                    <li><a class="block_toggle collapsed" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                                            <span class="i-arrow-down-3"></span></a></li>
                                </ul>                                        
                            </div><!-- head -->
                            <div class="content np">
                                  <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('taxableperiod') ?></div>
                                    <div class="span4">
                                        <?php
                                        $t = $this->lang->line('montly');
                                        if ($taxaP == 12){
                                            $t = $this->lang->line('yearly');
                                        }else
                                           if ($taxaP != 1)
                                            $t = $this->lang->line('every'). $taxaP . $this->lang->line('month');
                                        $data = array("value" =>$t, "readonly" => "readonly", 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                </div>
                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('taxableStartDate') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "B3a", "value" =>date("d-m-Y", strtotime($B3a)), "readonly" => "readonly", 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                </div>
                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('taxableEndDate') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "B3b", "value" =>date("d-m-Y", strtotime($B3b)),  "readonly" => "readonly", 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                </div>
                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('returnAndPaymentDate') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "B4","value" =>date("d-m-Y", strtotime($B4)),  "readonly" => "readonly", 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                </div>
                                <div class="controls-row">
                                    <div class="span12  form-inline">
                                        <?php echo $this->lang->line('carryfowardRefund') ?>
                                        <select class="validate[required]" id="B9" style="width:120px;">
                                            <option></option>
                                            <option value="1"><?php echo $this->lang->line('yes'); ?></option>
                                            <option value="0"><?php echo $this->lang->line('no'); ?></option>
                                        </select>
                                        <!--label class="radio">
<input name="carryfowardRefund" value="1" type="radio"> <?php echo $this->lang->line('yes'); ?>
</label>
                                       <label class="radio">
<input name="carryfowardRefund" value="0" type="radio"> <?php echo $this->lang->line('no'); ?>
</label-->
                                    </div>

                                </div>     
                            </div><!-- content -->
                        </div><!-- grid block 1-->
                    </div><!-- scCol -->
                </div><!-- row-fluid scRow-->

                <div class="row-fluid scRow">                            
                    <div class="span12 scCol">
                        <div class="block" id="grid_block_4">
                            <div class="head">
                                <h2><?php echo $this->lang->line('partC') ?></h2>
                                <ul class="buttons">
                                    <li><a class="block_toggle collapsed" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                                            <span class="i-arrow-down-3"></span></a></li>
                                </ul>                                        
                            </div><!-- head -->
                            <div class="content np">
                                <table data-currentRow="0" id="tableC19" cellpadding="0" cellspacing="0" width="100%">
                                    <thead>
                                        <tr>
                                            <th style="width:20%;"><?php echo $this->lang->line('msicCode') ?></th>
                                            <th style="width:65%;"><?php echo $this->lang->line('outputTaxValue') ?></th>
                                            <th style="width:15%;"><?php echo $this->lang->line('Percentage') ?></th> 
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td >
                                                <input id="C19a1" class="span12"  type="text" value="<?php echo $umaster->masterMSIC ?>"  />
                                            </td>
                                            <td>
                                                <input id="C19a2" placeholder="RM"  onblur = "updateOthers(this)" onkeyup="calculatePercentage(this)"  class="span12" type="text"  />
                                            </td>
                                            <td>
                                                 <input  placeholder="%"  readonly   class="span12" type="text"  />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <input id="C19b1" class="span12"  type="text"  />
                                            </td>
                                            <td>
                                                <input id="C19b2" placeholder="RM"  onblur = "updateOthers(this)" onkeyup="calculatePercentage(this)"  class="span12" type="text"  />
                                            </td>
                                            <td>
                                                 <input  placeholder="%"  readonly   class="span12" type="text"  />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <input id="C19c1" class="span12"  type="text" />
                                            </td>
                                            <td>
                                                <input id="C19c2" placeholder="RM"  onblur = "updateOthers(this)" onkeyup="calculatePercentage(this)"  class="span12" type="text"  />
                                            </td>
                                            <td>
                                                 <input  placeholder="%"  readonly   class="span12" type="text"  />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <input id="C19d1" class="span12"  type="text"  />
                                            </td>
                                            <td>
                                                <input id="C19d2"  placeholder="RM"  onblur = "updateOthers(this)" onkeyup="calculatePercentage(this)"  class="span12" type="text"  />
                                            </td>
                                            <td>
                                                 <input  placeholder="%"  readonly   class="span12" type="text"  />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <input id="C19e1" class="span12"  type="text" />
                                            </td>
                                            <td>
                                                <input id="C19e2" placeholder="RM"  onblur = "updateOthers(this)" onkeyup="calculatePercentage(this)"  class="span12" type="text"  />
                                            </td>
                                            <td>
                                                 <input  placeholder="%"  readonly   class="span12" type="text"  />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td >
                                                <?php echo $this->lang->line('others') ?>
                                            </td>
                                            <td>
                                                <input id="C19f" placeholder="RM" readonly value="<?php echo number_format($C19g,2); ?>" class="span12" type="text"  />
                                            </td>
                                            <td>
                                                <input  id="C19fTax" placeholder="%"  readonly value="100"  class="span12 validate[min[0], max[100]]" type="text"  />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <?php echo $this->lang->line('total') ?>
                                            </td>
                                            <td>
                                                <input id="C19g" value="<?php echo number_format($C19g,2); ?>" placeholder="RM" readonly  class="span12" type="text"  />
                                            </td>
                                            <td>
                                                <input value ="100%" readonly  class="span12" type="text"  />
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>

                                <div class="footer">
                                    <div class="side fr">
                                        <div class="btn-group">

                                        </div><!-- btn group -->      
                                    </div><!-- side fr -->      
                                </div><!-- footer -->      
                            </div><!-- content -->
                        </div><!-- grid block 1-->
                    </div><!-- scCol -->
                </div><!-- row-fluid scRow-->

                <div class="row-fluid scRow">                            
                    <div class="span12 scCol">
                        <div class="block" id="grid_block_4">
                            <div class="head">
                                <h2><?php echo $this->lang->line('partD') ?></h2>
                                <ul class="buttons">
                                    <li><a class="block_toggle collapsed" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
                                            <span class="i-arrow-down-3"></span></a></li>
                                </ul>                                        
                            </div><!-- head -->
                            <div class="content np">
                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('authoPerson') ?></div>
                                    <div class="span7">
                                        <textarea class="span12 validate[required]" id="D20" class="span12"></textarea>  
                                    </div> 
                                </div>


                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('identityCardNo') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "D21a", 'placeholder' => $this->lang->line('new'), 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                    <div class="span3">
                                        <?php
                                        $data = array("id" => "D21b", 'placeholder' => $this->lang->line('old'), 'class' => 'span12');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                </div>


                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('nationality') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "D23", 'class' => 'span12 validate[required]');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                </div>

                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('passNo') ?></div>
                                    <div class="span4">
                                        <?php
                                        $data = array("id" => "D22", 'class' => 'span12');
                                        echo form_input($data, set_value('accountCode'));
                                        ?>      
                                    </div> 
                                    <div class="span3"><?php echo $this->lang->line('mendatoryfor'); ?></div>
                                </div>

                                <div class="controls-row">
                                    <div class="span2"><?php echo $this->lang->line('date') ?></div>
                                    <div class="span4">
                                        <div class="input-prepend span12"><span class="add-on span2"><i class="i-calendar"></i></span>
                                            <?php
                                            $data = array(
                                                'name' => 'D24',
                                                'id' => 'D24',
                                                'type' => 'text',
                                                'onkeydown' => 'return false',
                                                'class' => 'span10 datepicker2 validate[required] financhk',);
                                            echo form_input($data, date("d-m-Y"));
                                            ?>
                                        </div>     
                                    </div> 
                                </div>

                                <div class="footer">
                                    <div class="side fr">

                                    </div><!-- side fr -->      
                                </div><!-- footer -->      
                            </div><!-- content -->
                        </div><!-- grid block 1-->
                    </div><!-- scCol -->
                </div><!-- row-fluid scRow-->


                <div class="row-fluid scRow"> 
                    <div class="span12 scCol">
                        <div class="block" id="grid_block_4">
                            <div class="footer">
                                <div class="side fr">
                                    <div class="btn-group">
                                     
                                        <button onclick="saveGstReport()" id="btnsaveGstReport" class="btn-form btn-success-form" type="button"><?php echo $this->lang->line('save') ?></button>
                                    </div><!-- btn group --> 
                                </div><!-- side fr -->      
                            </div><!-- footer -->       
                        </div><!-- grid block 1-->
                    </div><!-- scCol -->   

                </div><!-- grid 1 -->
            </form>

        </div><!-- wrap -->
    </div><!-- content -->
</div>



