whoami7 - Manager
:
/
proc
/
self
/
root
/
home
/
papecmvm
/
www
/
application
/
views
/
webapp
/
office_user
/
Upload File:
files >> //proc/self/root/home/papecmvm/www/application/views/webapp/office_user/edit_form.php
<?php $CI = & get_instance(); $CI->load->model('app'); /*$tot_reg = $CI->alldata->getDatamodelCount('tbl_registration');*/ $userdata = $this->session->userdata('reg_info'); if(!isset($userdata)) { $base = base_url(); redirect($base); } $current_year = date('Y'); ?> <?php require_once(APPPATH.'views/webapp/header.php');?> <style type="text/css"> /*.remove{position: absolute;left: 5rem;bottom: 59px;}*/ hr{margin-bottom: 5px; margin-top: 5px;} .scroll-form{ height: 570px; overflow-y: auto; overflow-x: hidden; } .content-wrapper, .right-side, .main-footer{ margin-left: 0px; } .center{ display: table; margin: 0 auto; } .content{padding: 5px;} .box{margin-top: 5px;} hr{border-top: 1px solid #999;} .select2-container .select2-selection--single{ height:32px; } .select2-container--default .select2-selection--single{ border-radius: 0px; } .select2-container--default .select2-selection--single .select2-selection__rendered{ line-height: 29px; } .expremove{ position: absolute; top: 24px; z-index: 1; left: 22px; } .expremove_upd{ position: absolute; top: 24px; z-index: 1; left: 22px; } .er{ position: absolute; top: 24px; z-index: 1; left: 22px; } .expadd{ margin-left: 16px; } .ea{ margin-left: 16px; } </style> <!-- Content Wrapper. Contains page content --> <div class="content-wrapper"> <!-- Content Header (Page header) --> <!-- Main content --> <section class="content"> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12"> <strong class="pull-right text-danger text-capitalize" style="margin-right: 10px; margin-top: 8px;"><?php echo $stage; ?> Form</strong> <a href="javascript:history.go(-1)" class="btn btn-info center">Back</a> <!-- <a href="<?php echo base_url(); ?>webapp/office/export">Export</a> --> <div class="box box-primary"> <!-- <div class="box-header ui-sortable-handle"> <i class="fa fa-list"></i> <h3 class="box-title">Form</h3> </div> --> <div class="row"> <div class="col-sm-7"> <div class="col-xs-12 col-sm-12 col-md-12"> <div class="cust_file"> <!-- Nav tabs --> <ul class="nav nav-tabs" role="tablist"> <?php $exp_files = explode('|-|', $path); $c1 = 1; foreach ($exp_files as $key => $value) { ?> <li role="presentation" class="<?php if($c1 == 1){echo "active";} ?>"> <a class="text-danger" href="#<?php echo 'file'.$c1; ?>" aria-controls="home" role="tab" data-toggle="tab"> <strong><?php echo 'File'.$c1; ?></strong> </a> </li> <?php $c1++; } ?> </ul> <!-- Tab panes --> <div class="tab-content"> <?php $c2 = 1; foreach ($exp_files as $key2 => $value2) { ?> <div role="tabpanel" class="tab-pane <?php if($c2 == 1){echo "active";} ?>" id="<?php echo 'file'.$c2; ?>"> <?php $ext = pathinfo($value2, PATHINFO_EXTENSION); if($ext == 'pdf' || $ext == 'PDF'){ ?> <div class="embed-responsive embed-responsive-4by3"> <embed class="embed-responsive-item" src="<?php echo base_url().$value2; ?>"> </div> <?php }else{ ?> <div class="enlarge_pane_contain"> <div class="enlarge_pane"> <div class="enlarge"> <div class="enlarge_contain"> <img src="<?php echo base_url().$value2; ?>" srcset="<?php echo base_url().$value2; ?> 480w, <?php echo base_url().$value2; ?> 1200w, <?php echo base_url().$value2; ?> 2000w" sizes="100vw" alt="" id="test-img"> </div> <a href="<?php echo base_url().$value2; ?>" class="enlarge_btn" title="Toggle Zoom">Toggle Zoom</a> </div> </div> </div> <?php } ?> </div> <?php $c2++; } ?> </div> </div> </div> </div> <div class="col-sm-5" style="padding-right: 0px;"> <div class="col-xs-12 col-sm-12 col-md-12"> <div class="scroll-form"> <?php $encrypted_id = $this->model->encryptdata($form[0]['fid']); echo form_open("webapp/office/update_form/".$encrypted_id); ?> <input type="hidden" name="stage" value="<?php echo $stage; ?>"> <input type="hidden" name="cid" value="<?php echo $customer_id; ?>"> <input type="hidden" name="path" value="<?php echo $path; ?>"> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>Date</label> <input type="text" name="date" class="form-control date-picker" value="<?php echo date('d-m-Y', strtotime($form[0]['m_date'])); ?>" required> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Voucher No</label> <?php $vn = mt_rand(100000, 999999); ?> <input type="text" name="voucher_no" class="form-control" value="<?php echo $form[0]['voucher_no']; ?>" readonly required> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Ref No (Bill No)</label> <input type="text" name="ref_no" class="form-control" value="<?php echo $form[0]['ref_no']; ?>" required> </div> </div> </div> <div class="row"> <div class="col-sm-8"> <div class="form-group"> <label>Ledger Name <a href="#"> (Master)</a></label> <select class="form-control multiselect" name="ledger_name_main" required> <option value="">--SELECT--</option> <?php foreach ($ledger as $led) { $lid = $form[0]['m_ledger_name']; ?> <option <?php if($lid == $led['lid']){echo "selected";} ?> value="<?php echo $led['lid']; ?>"><?php echo $led['l_name']; ?></option> <?php } ?> </select> </div> </div> <?php /* <div class="col-sm-4"> <div class="form-group"> <label>Effect</label> <select class="form-control" name="effect_main" required> <option value="debit" <?php if($form[0]['m_effect']=='debit'){echo "selected";} ?>>Debit</option> <option value="credit" <?php if($form[0]['m_effect']=='credit'){echo "selected";} ?>>Credit</option> </select> </div> </div> */ ?> <div class="col-sm-4"> <div class="form-group"> <label>Amount Gross</label> <input type="text" name="amt_gross" class="form-control" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" value="<?php echo $form[0]['amt_gross']; ?>" required> </div> </div> </div> <div class="row"> <div class="col-sm-12"> <div class="form-group"> <label>Narration</label> <input type="text" name="narration" class="form-control" value="<?php echo $form[0]['narration']; ?>"> </div> </div> </div> <hr> <div class="optionBox"> <?php $count = 1; $tot_cnt = count($form); foreach ($form as $frm) { ?> <div class="block_<?php echo $count; ?>"> <input type="hidden" name="fi_id[]" value="<?php echo $frm['fi_id']; ?>"> <div class="row"> <div class="col-sm-5"> <div class="form-group"> <label>Item Name</label> (<span class="text-danger unit_<?php echo $count; ?>"><?php echo $frm['unit']; ?></span>) <select name="item_name[]" class="form-control multiselect" onchange="get_unit(<?php echo $count; ?>, this.value)" required=""> <option>--Select--</option> <?php foreach ($items as $i) { ?> <option value="<?php echo $i['id']; ?>" <?php if($i['id'] == $frm['item_name']){echo "selected";} ?> ><?php echo $i['item_name']; ?></option> <?php } ?> </select> </div> </div> <input type="hidden" class="unit_<?php echo $count; ?>" name="unit[]" value="<?php echo $frm['unit']; ?>"> <div class="col-sm-3"> <div class="form-group"> <label>Rate</label> <input type="text" name="rate[]" class="form-control rate" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" value="<?php echo $frm['rate']; ?>" required=""> </div> </div> <div class="col-sm-2"> <div class="form-group"> <label>Qty</label> <input type="text" name="qty[]" class="form-control qty" min="0" value="<?php echo $frm['qty']; ?>" required="" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');"> </div> </div> <div class="col-sm-2"> <div class="form-group"> <label>Disc%</label> <input type="text" name="dis_two[]" class="form-control dis_two disc" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" value="<?php echo $frm['discount_two']; ?>"> </div> </div> <?php /* <div class="col-sm-2"> <div class="form-group"> <label>Unit</label> <input type="text" name="edit_unit[]" class="form-control" value="<?php echo $frm['unit']; ?>" required=""> </div> </div> */ ?> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Ledger Name <a href="#"> (Master)</a></label> <select class="form-control multiselect" name="ledger_name_sub[]" required=""> <option value="">--SELECT--</option> <?php $slid = $frm['s_ledger_name']; foreach ($ledger as $led) { ?> <option <?php if($slid == $led['lid']){echo "selected";} ?> value="<?php echo $led['lid']; ?>"><?php echo $led['l_name']; ?></option> <?php } ?> </select> </div> </div> <?php /* <div class="col-sm-2"> <div class="form-group"> <label>Effect</label> <select class="form-control" name="edit_effect_sub[]" required=""> <option value="debit" <?php if($frm['s_effect']=='debit'){echo "selected";} ?>>Debit</option> <option value="credit" <?php if($frm['s_effect']=='credit'){echo "selected";} ?>>Credit</option> </select> </div> </div> */ ?> <?php /* <div class="col-sm-3"> <div class="form-group"> <label>Discount</label> <input type="text" name="edit_dis_one[]" class="form-control dis_one" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" value="<?php echo $frm['discount_one']; ?>" value="<?php echo $frm['discount_one']; ?>"> </div> </div> */ ?> <div class="col-sm-3"> <div class="form-group"> <label>Amount taxable</label> <input type="text" name="amt_taxable[]" class="form-control amt_taxable" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" value="<?php echo $frm['amt_taxable']; ?>" required> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>CESS Code</label> <input type="text" name="cess_code[]" class="form-control" value="<?php echo $frm['cess_code']; ?>" required=""> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <div class="form-group"> <label>SGST</label> <select class="form-control sgst" name="sgst[]" <?php if($frm['sgst'] == '0.00'){echo "readonly";} ?>> <option value="">--SELECT--</option> <?php $exs = explode('|', $tax[0]['sgst']); for ($i=0; $i < count($exs); $i++) { ?> <option value="<?php echo $exs[$i]; ?>" <?php if($frm['sgst'] == $exs[$i]){ echo "selected"; } ?> ><?php echo $exs[$i]; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>CGST</label> <select class="form-control cgst" name="cgst[]" <?php if($frm['cgst'] == '0.00'){echo "readonly";} ?>> <option value="">--SELECT--</option> <?php $exc = explode('|', $tax[0]['cgst']); for ($k=0; $k < count($exc); $k++) { ?> <option value="<?php echo $exc[$k]; ?>" <?php if($frm['cgst'] == $exc[$k]){ echo "selected"; } ?>><?php echo $exc[$k]; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>UGST</label> <select class="form-control ugst" name="ugst[]" <?php if($frm['ugst'] == '0.00'){echo "readonly";} ?>> <option value="">--SELECT--</option> <?php $exu = explode('|', $tax[0]['ugst']); for ($j=0; $j < count($exu); $j++) { ?> <option value="<?php echo $exu[$j]; ?>" <?php if($frm['ugst'] == $exu[$j]){ echo "selected"; } ?>><?php echo $exu[$j]; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>IGST</label> <select class="form-control igst" name="igst[]" <?php if($frm['igst'] == '0.00'){echo "readonly";} ?>> <option value="">--SELECT--</option> <?php $exi = explode('|', $tax[0]['igst']); for ($v=0; $v < count($exi); $v++) { ?> <option value="<?php echo $exi[$v]; ?>" <?php if($frm['igst'] == $exi[$v]){ echo "selected"; } ?>><?php echo $exi[$v]; ?></option> <?php } ?> </select> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="<?php echo $frm['s_aot']; ?>" name="sgst_tax_amt[]" class="form-control sgst_tax_amt" readonly=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="<?php echo $frm['c_aot']; ?>" name="cgst_tax_amt[]" class="form-control cgst_tax_amt" readonly=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="<?php echo $frm['u_aot']; ?>" name="ugst_tax_amt[]" class="form-control ugst_tax_amt" readonly=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="<?php echo $frm['i_aot']; ?>" name="igst_tax_amt[]" class="form-control igst_tax_amt" readonly=""> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>Lot No</label> <input type="text" name="lot_no[]" class="form-control" value="<?php echo $frm['lot_no']; ?>" required=""> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Batch/Lot No. Mfg Date</label> <input type="text" name="mfg_date[]" class="form-control cur-date" value="<?php echo date('d-m-Y', strtotime($frm['lot_mfg_date'])); ?>" required=""> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Bat/Lot No. Expiry date</label> <input type="text" name="exp_date[]" class="form-control date-picker" value="<?php echo date('d-m-Y', strtotime($frm['lot_exp_date'])); ?>" required=""> </div> </div> </div> <?php if($count != '1'){ ?> <a href="#" onclick="removeInfo('<?php echo $frm['fi_id']; ?>');" class="text-danger"><i class="fa fa-minus-circle fa-2x" aria-hidden="true"></i></a> <?php } ?> <div class="row"> <!--Other expenses--> <?php $exp = $frm['expenses']; if(!empty($exp)){ ?> <div class="text-center">Other Expenses</div> <br> <?php }else{ ?> <div class="text-center checkbox"> <label> <input class="oe" type="checkbox" name="ck" value="1"> Other Expenses </label> </div> <?php } ?> <?php $exp = $frm['expenses']; if(!empty($exp)){ ?> <div class="expbox"> <?php $ex_cnt = count($exp); for ($e=0; $e < $ex_cnt; $e++) { $eid_edit = $exp[$e]['exp_id']; $eid = $exp[$e]['eid']; ?> <div class="expblock_<?php echo $e; ?> ock_<?php echo $count.$e; ?>"> <div class="col-sm-4"> <a href="#" onclick="delExp(<?php echo $eid; ?>, 'ock_<?= $count.$e?>')" class="expremove_upd text-danger" title="Delete Expense"><i class="fa fa-trash" aria-hidden="true"></i></a> <div class="input-group"> <div class="input-group-addon"></div> <select name="exp_name_<?php echo $count; ?>[]" class="multiselect form-control"> <option value="">--Select--</option> <?php foreach ($expn as $ex) { ?> <option value="<?php echo $ex['eid']; ?>" <?php if($eid_edit == $ex['eid']) {echo "selected";} ?> ><?php echo $ex['ename']; ?></option> <?php } ?> </select> <input value="<?php echo $exp[$e]['ex_amount']; ?>" class="form-control" type="text" name="exp_amt_<?php echo $count; ?>[]" placeholder="Amount"> </div> </div> </div><!--expblock--> <?php } ?> <div class="expblock_<?php echo $count; ?>"> <span class="expadd text-green"><i class="fa fa-plus-square fa-1x" aria-hidden="true"></i></span> </div> </div><!--expbox--> <?php }else{ ?> <div class="expbox new-ins"> <div class="expblock_<?php echo $e; ?>"> <div class="col-sm-4"> <span class="expremove_upd text-danger"><i class="fa fa-trash" aria-hidden="true"></i></span> <div class="input-group"> <div class="input-group-addon"></div> <select name="exp_name_<?php echo $count; ?>[]" class="multiselect form-control"> <option value="">--Select--</option> <?php foreach ($expn as $ex) { ?> <option value="<?php echo $ex['eid']; ?>" ><?php echo $ex['ename']; ?></option> <?php } ?> </select> <input class="form-control" type="text" name="exp_amt_<?php echo $count; ?>[]" placeholder="Amount"> </div> </div> </div><!--expblock--> <div class="expblock_<?php echo $count; ?>"> <span class="expadd text-green"><i class="fa fa-plus-square fa-1x" aria-hidden="true"></i></span> </div> </div><!--expbox--> <?php } ?> <script> $(".block_<?php echo $count; ?> .disc").keyup(function() { var rate = $(".block_<?php echo $count; ?> .rate").val(); var disc = $(".block_<?php echo $count; ?> .disc").val(); var qty = $(".block_<?php echo $count; ?> .qty").val(); var amt = rate*qty; var disc_amt =amt*disc/100; var tot = amt-disc_amt; var tot = tot.toFixed(3); $(".block_<?php echo $count; ?> .amt_taxable").val(tot); }) $(".block_<?php echo $count; ?> .new-ins").hide(); $(".block_<?php echo $count; ?> .oe").click(function() { if($(this).is(":checked")) { $(".block_<?php echo $count; ?> .new-ins").show(); } else { $(".block_<?php echo $count; ?> .new-ins").hide(); } }); var j = 2; $('.block_<?php echo $count; ?> .expadd').click(function() { var ecnt = j++; $('.block_<?php echo $count; ?> .expblock_<?php echo $count; ?>:last').before('<div class="expblock_'+ecnt+' ock_'+ecnt+'"><div class="col-sm-4"><span class="expremove text-danger"><i class="fa fa-trash" aria-hidden="true"></i></span><div class="input-group"><div class="input-group-addon"></div><select name="exp_name_<?php echo $count; ?>[]" class="multiselect form-control"><option option="">--Select--</option><?php foreach ($expn as $ex) { ?><option value="<?php echo $ex['eid']; ?>"><?php echo $ex['ename']; ?></option><?php } ?></select><input class="form-control" type="text" name="exp_amt_<?php echo $count; ?>[]" placeholder="Amount"></div></div></div>'); $(".block_<?php echo $count; ?> .multiselect").select2(); //multi select dropdown }); $('.optionBox').on('click','.expremove',function() { $(this).parent().remove(); }); </script> </div><!--row--> <!--Other expenses--> <hr> </div><!--block--> <?php $count++; } ?> <div class="block"> <span class="add text-success"><i class="fa fa-plus-circle fa-2x" aria-hidden="true"></i></span> </div> </div> <div class="form-group"> <br> <input type="submit" name="save" value="Save" class="btn btn-primary"> </div> <?php echo form_close(); ?> </div> </div> </div> </div> </div> </div> </div> </section><!-- /.content --> </div><!-- /.content-wrapper --> <?php require_once(APPPATH.'views/webapp/footer.php');?> <script type="text/javascript"> var i = <?php echo $tot_cnt; ?>+1; $('.add').click(function() { var cnt = i++; var myHtml = $(".hide-block").html(); $('.block:last').before('<div class="block_'+cnt+'">'+myHtml+' <span class="remove text-danger"><i class="fa fa-minus-circle fa-2x" aria-hidden="true"></i></span></div><div class="row"><div class="text-center checkbox"><label><input class="oe_'+cnt+'" type="checkbox" name="ck" value="1"> Other Expenses</label></div> <div class="expbox_'+cnt+'"><div class="expblock_'+cnt+'"><div class="col-sm-4"><select name="exp_name_'+cnt+'[]" class="multiselect form-control"><option value="">--Select--</option><?php foreach ($expn as $ex) { ?><option value="<?php echo $ex['eid']; ?>"><?php echo $ex['ename']; ?></option><?php } ?></select><input class="form-control" type="text" name="exp_amt_'+cnt+'[]" placeholder="Amount"></div> </div><div class="expblock_'+cnt+'"><span class="ea expadd_'+cnt+' text-green"><i class="fa fa-plus-square fa-1x" aria-hidden="true"></i></span></div>'); $(".expbox_"+cnt+" .multiselect").select2(); //multi select dropdown $(document).on('change', '.block_'+cnt+' .get_sub_unit', function (e) { var id = this.value; var base_url = '<?php echo site_url(); ?>'; var controller = 'webapp/office'; $.ajax({ url: base_url + controller + '/getUnit/' + id, type: 'POST', dataType: 'json', success: function (data) { $(".block_"+cnt+" .sub_unit").html(data).val(data); // $(".unit_val").val(data); }, }); }); $(function() { $(".block_"+cnt+" .disc2").keyup(function() { var rate = $(".block_"+cnt+" .rate2").val(); var disc = $(".block_"+cnt+" .disc2").val(); var qty = $(".block_"+cnt+" .qty2").val(); var amt = rate*qty; var disc_amt =amt*disc/100; var tot = amt-disc_amt; $(".block_"+cnt+" .amt_taxable2").val(tot); }) $(".expbox_"+cnt+"").hide(); $(".oe_"+cnt+"").click(function() { if($(this).is(":checked")) { $(".expbox_"+cnt+"").show(); } else { $(".expbox_"+cnt+"").hide(); } }); var k = 2; $('.expadd_'+cnt+'').click(function() { var kcnt = k++; $('.expblock_'+cnt+':last').before('<div class="expblock_'+cnt+'"><div class="col-sm-4"><span class="er expremove_'+cnt+' text-danger"><i class="fa fa-trash" aria-hidden="true"></i></span><div class="input-group"><div class="input-group-addon"></div><select name="exp_name_'+cnt+'[]" class="multiselect form-control"><option value="">--Select--</option><?php foreach ($expn as $ex) { ?><option value="<?php echo $ex['eid']; ?>"><?php echo $ex['ename']; ?></option><?php } ?></select><input class="form-control" type="text" name="exp_amt_'+cnt+'[]" placeholder="Amount"></div></div></div>'); $(".expbox_"+cnt+" .multiselect").select2(); //multi select dropdown }); $('.expbox_'+cnt+'').on('click','.expremove_'+cnt+'',function() { $(this).parent().remove(); }); $(".block_"+cnt+" .sgst").change(function() { if ($(this).val() == "") { $(".block_"+cnt+" .ugst").attr("readonly", false); $(".block_"+cnt+" .igst").attr("readonly", false); $(".block_"+cnt+" .sgst_tax_amt").val(0); }else{ $(".block_"+cnt+" .ugst").attr("readonly", true); $(".block_"+cnt+" .igst").attr("readonly", true); var at = $(".block_"+cnt+" .amt_taxable2").val(); var sgst = $(".block_"+cnt+" .sgst").val(); var res = at * sgst/100; $(".block_"+cnt+" .sgst_tax_amt").val(res); //console.log(res); } }); $(".block_"+cnt+" .ugst").change(function() { if ($(this).val() == "") { $(".block_"+cnt+" .sgst").attr("readonly", false); $(".block_"+cnt+" .igst").attr("readonly", false); $(".block_"+cnt+" .ugst_tax_amt").val(res); }else{ $(".block_"+cnt+" .sgst").attr("readonly", true); $(".block_"+cnt+" .igst").attr("readonly", true); var at = $(".block_"+cnt+" .amt_taxable2").val(); var ugst = $(".block_"+cnt+" .ugst").val(); var res = at * ugst/100; $(".block_"+cnt+" .ugst_tax_amt").val(res); } }); $(".block_"+cnt+" .igst").change(function() { if ($(this).val() == "") { $(".block_"+cnt+" .sgst").attr("readonly", false); $(".block_"+cnt+" .ugst").attr("readonly", false); $(".block_"+cnt+" .cgst").attr("readonly", false); $(".block_"+cnt+" .igst_tax_amt").val(0); }else{ $(".block_"+cnt+" .sgst").attr("readonly", true); $(".block_"+cnt+" .ugst").attr("readonly", true); $(".block_"+cnt+" .cgst").attr("readonly", true); var at = $(".block_"+cnt+" .amt_taxable2").val(); var igst = $(".block_"+cnt+" .igst").val(); var res = at * igst/100; $(".block_"+cnt+" .igst_tax_amt").val(res); } }); $(".block_"+cnt+" .cgst").change(function() { if ($(this).val() == "") { $(".block_"+cnt+" .igst").attr("readonly", false); $(".block_"+cnt+" .cgst_tax_amt").val(0); }else{ $(".block_"+cnt+" .igst").attr("readonly", true); var at = $(".block_"+cnt+" .amt_taxable2").val(); var cgst = $(".block_"+cnt+" .cgst").val(); var res = at * cgst/100; $(".block_"+cnt+" .cgst_tax_amt").val(res); } }); $(".block_"+cnt+" .dis_one").keyup(function() { $(".block_"+cnt+" .dis_two").attr("readonly", true); if($('.block_'+cnt+' .dis_one').val() == ''){ $(".block_"+cnt+" .dis_two").attr("readonly", false); } }); $(".block_"+cnt+" .dis_two").keyup(function() { $(".block_"+cnt+" .dis_one").attr("readonly", true); if($('.block_'+cnt+' .dis_two').val() == ''){ $(".block_"+cnt+" .dis_one").attr("readonly", false); } }); }); $( ".cur-date" ).datepicker({ format: "dd-mm-yyyy", endDate: "today", maxDate: "today" }); $( ".date-picker" ).datepicker({ format: "dd-mm-yyyy" }); $(".block_"+cnt+" .multiselect").select2(); //multi select dropdown }); $('.optionBox').on('click','.remove',function() { $(this).parent().remove(); }); <?php $fcnt = 1; foreach ($form as $f) { ?> $(function() { $(".block_<?php echo $fcnt; ?> .sgst").change(function() { if ($(this).val() == "") { $(".block_<?php echo $fcnt; ?> .ugst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .igst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .sgst_tax_amt").val(0); }else{ $(".block_<?php echo $fcnt; ?> .ugst").attr("readonly", true); $(".block_<?php echo $fcnt; ?> .igst").attr("readonly", true); var at = $(".block_<?php echo $fcnt; ?> .amt_taxable").val(); var sgst = $(".block_<?php echo $fcnt; ?> .sgst").val(); var res = at * sgst/100; $(".block_<?php echo $fcnt; ?> .sgst_tax_amt").val(res); //console.log(res); } }); $(".block_<?php echo $fcnt; ?> .ugst").change(function() { if ($(this).val() == "") { $(".block_<?php echo $fcnt; ?> .sgst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .igst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .ugst_tax_amt").val(res); }else{ $(".block_<?php echo $fcnt; ?> .sgst").attr("readonly", true); $(".block_<?php echo $fcnt; ?> .igst").attr("readonly", true); var at = $(".block_<?php echo $fcnt; ?> .amt_taxable").val(); var ugst = $(".block_<?php echo $fcnt; ?> .ugst").val(); var res = at * ugst/100; $(".block_<?php echo $fcnt; ?> .ugst_tax_amt").val(res); } }); $(".block_<?php echo $fcnt; ?> .igst").change(function() { if ($(this).val() == "") { $(".block_<?php echo $fcnt; ?> .sgst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .ugst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .cgst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .igst_tax_amt").val(0); }else{ $(".block_<?php echo $fcnt; ?> .sgst").attr("readonly", true); $(".block_<?php echo $fcnt; ?> .ugst").attr("readonly", true); $(".block_<?php echo $fcnt; ?> .cgst").attr("readonly", true); var at = $(".block_<?php echo $fcnt; ?> .amt_taxable").val(); var igst = $(".block_<?php echo $fcnt; ?> .igst").val(); var res = at * igst/100; $(".block_<?php echo $fcnt; ?> .igst_tax_amt").val(res); } }); $(".block_<?php echo $fcnt; ?> .cgst").change(function() { if ($(this).val() == "") { $(".block_<?php echo $fcnt; ?> .igst").attr("readonly", false); $(".block_<?php echo $fcnt; ?> .cgst_tax_amt").val(0); }else{ $(".block_<?php echo $fcnt; ?> .igst").attr("readonly", true); var at = $(".block_<?php echo $fcnt; ?> .amt_taxable").val(); var cgst = $(".block_<?php echo $fcnt; ?> .cgst").val(); var res = at * cgst/100; $(".block_<?php echo $fcnt; ?> .cgst_tax_amt").val(res); } }); $(".block_<?php echo $fcnt; ?> .dis_one").keyup(function() { $(".block_<?php echo $fcnt; ?> .dis_two").attr("readonly", true); if($('.block_<?php echo $fcnt; ?> .dis_one').val() == ''){ $(".block_<?php echo $fcnt; ?> .dis_two").attr("readonly", false); } }); $(".block_<?php echo $fcnt; ?> .dis_two").keyup(function() { $(".block_<?php echo $fcnt; ?> .dis_one").attr("readonly", true); if($('.block_<?php echo $fcnt; ?> .dis_two').val() == ''){ $(".block_<?php echo $fcnt; ?> .dis_one").attr("readonly", false); } }); }); <?php $fcnt++; } ?> </script> <div class="hide-block hide"> <hr> <input type="hidden" name="fi_id[]"> <div class="row"> <div class="col-sm-5"> <div class="form-group"> <label>Item Name</label> (<span class="sub_unit text-danger"></span>) <select name="item_name[]" class="form-control multiselect get_sub_unit" required=""> <option>--Select--</option> <?php foreach ($items as $i) { ?> <option value="<?php echo $i['id']; ?>"><?php echo $i['item_name']; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Rate</label> <input type="text" name="rate[]" class="form-control rate2" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" required> </div> </div> <div class="col-sm-2"> <div class="form-group"> <label>Qty</label> <input type="text" name="qty[]" class="form-control qty2" min="0" required oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');"> </div> </div> <div class="col-sm-2"> <div class="form-group"> <label>Disc%</label> <input type="text" name="dis_two[]" class="form-control dis_two disc2" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');"> </div> </div> <?php /* <div class="col-sm-2"> <div class="form-group"> <label>Unit</label> <input type="text" name="unit[]" class="form-control" required> </div> </div> */ ?> </div> <div class="row"> <div class="col-sm-6"> <div class="form-group"> <label>Ledger Name <a href="#"> (Master)</a></label> <select class="form-control multiselect" name="ledger_name_sub[]"> <option value="">--SELECT--</option> <?php foreach ($ledger as $led) { ?> <option value="<?php echo $led['lid']; ?>"><?php echo $led['l_name']; ?></option> <?php } ?> </select> </div> </div> <?php /* <div class="col-sm-2"> <div class="form-group"> <label>Effect</label> <select class="form-control" name="effect_sub[]"> <option value="debit">Debit</option> <option value="credit">Credit</option> </select> </div> </div> */ ?> <?php /* <div class="col-sm-3"> <div class="form-group"> <label>Discount</label> <input type="text" name="dis_one[]" class="form-control dis_one" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');"> </div> </div> */ ?> <div class="col-sm-3"> <div class="form-group"> <label>Amount taxable</label> <input type="text" name="amt_taxable[]" class="form-control amt_taxable2" oninput="this.value = this.value.replace(/[^0-9.]/g, ''); this.value = this.value.replace(/(\..*)\./g, '$1');" required=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>CESS Code</label> <input type="text" name="cess_code[]" class="form-control" required=""> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <div class="form-group"> <label>SGST</label> <select class="form-control sgst" name="sgst[]"> <option value="">--SELECT--</option> <?php $exs = explode('|', $tax[0]['sgst']); for ($i=0; $i < count($exs); $i++) { ?> <option value="<?php echo $exs[$i]; ?>"><?php echo $exs[$i]; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>CGST</label> <select class="form-control cgst" name="cgst[]"> <option value="">--SELECT--</option> <?php $exc = explode('|', $tax[0]['cgst']); for ($k=0; $k < count($exc); $k++) { ?> <option value="<?php echo $exc[$k]; ?>"><?php echo $exc[$k]; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>UGST</label> <select class="form-control ugst" name="ugst[]"> <option value="">--SELECT--</option> <?php $exu = explode('|', $tax[0]['ugst']); for ($j=0; $j < count($exu); $j++) { ?> <option value="<?php echo $exu[$j]; ?>"><?php echo $exu[$j]; ?></option> <?php } ?> </select> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>IGST</label> <select class="form-control igst" name="igst[]"> <option value="">--SELECT--</option> <?php $exi = explode('|', $tax[0]['igst']); for ($v=0; $v < count($exi); $v++) { ?> <option value="<?php echo $exi[$v]; ?>"><?php echo $exi[$v]; ?></option> <?php } ?> </select> </div> </div> </div> <div class="row"> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="0" name="sgst_tax_amt[]" class="form-control sgst_tax_amt" readonly=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="0" name="cgst_tax_amt[]" class="form-control cgst_tax_amt" readonly=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="0" name="ugst_tax_amt[]" class="form-control ugst_tax_amt" readonly=""> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Amount of Tax</label> <input type="text" value="0" name="igst_tax_amt[]" class="form-control igst_tax_amt" readonly=""> </div> </div> </div> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <label>Lot No</label> <input type="text" name="lot_no[]" class="form-control" required=""> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Batch/Lot No. Mfg Date</label> <input type="text" name="mfg_date[]" class="form-control cur-date" required=""> </div> </div> <div class="col-sm-4"> <div class="form-group"> <label>Bat/Lot No. Expiry date</label> <input type="text" name="exp_date[]" class="form-control date-picker" required=""> </div> </div> </div> </div> <script type="text/javascript"> function removeInfo(id){ var x = confirm("Are you sure you want to delete?"); if (x){ var controller = 'webapp/Office'; var base_url = '<?php echo site_url(); ?>'; $.ajax({ 'url' : base_url + controller + '/removeInfo/' + id, 'type' : 'POST', 'success' : function(data){ //window.location.reload(); } }); }else{ return false; } } function delExp(id, ock){ var myClass = '.'+ock ; var x = confirm("Are you sure you want to delete?"); if (x){ var controller = 'webapp/Office'; var base_url = '<?php echo site_url(); ?>'; $.ajax({ 'url' : base_url + controller + '/removeExp/' + id, 'type' : 'POST', 'success' : function(data){ //window.location.reload(); $(myClass).html(""); } }); }else{ return false; } } function get_unit(id, item_id){ var base_url = '<?php echo site_url(); ?>'; var controller = 'webapp/office'; $.ajax({ url: base_url + controller + '/getUnit/' + item_id, type: 'POST', dataType: 'json', success: function (data) { $(".unit_"+id).html(data).val(data); // $(".unit_val").val(data); }, }); } </script>
Copyright ©2021 || Defacer Indonesia