EVOLUTION-NINJA
Edit File: add_suborder_madeups.php
<?php // print_r($result); // die(); ?> <script src="<?php echo base_url('assets/js/jquery.table2excel.js');?>"></script> <script src="<?php echo base_url('assets/js/jspdf.debug.js');?>"></script> <script src="<?php echo base_url('assets/js/jspdf.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/shim.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/xlsx.full.min.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/Blob.js');?>"></script> <script type="text/javascript" src="<?php echo base_url('assets/js/FileSaver.js');?>"></script> <script type="text/ecmascript" src="<?php echo base_url('assets/js/jquery.min.js');?>"></script> <script src="<?php echo base_url('assets/js/bootstrap.min.js');?>"></script> <!-- This is the Javascript file of jqGrid --> <script type="text/ecmascript" src="<?php echo base_url('assets/js/jquery.jqGrid.min.js');?>"></script> <!-- This is the localization file of the grid controlling messages, labels, etc. We support more than 40 localizations --> <script type="text/ecmascript" src="<?php echo base_url('assets/js/grid.locale-en.js');?>"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css" rel="stylesheet"/> <style> .ui-jqgrid { text-transform: capitalize !important; } .tablediv { text-transform: uppercase !important; } .ui-jqgrid tr.jqgrow td{ text-transform: uppercase !important; } </style> <script> function back_func() { window.location.href = "<?php echo base_url('reports/inspected_fabric'); ?>" } </script> <div class="page-content-wrapper"> <div class="page-content"> <!-- BEGIN PAGE HEADER--> <!-- <h3 class="page-title"> Order List </h3> --> <div class="page-bar"> <ul class="page-breadcrumb"> <li><i class="fa fa-home"></i> <a href="<?php echo base_url();?>dashboard/dashboard_fun">Home</a> <i class="fa fa-angle-right"></i> <a href="<?php echo base_url();?>dashboard/dashboard_fun" > Dashboard </a></li> </ul> </div> <!-- <input type="hidden" value="<?php echo date('m'); ?>" id="get_months" > <input type="button" name="Insert" data-toggle="modal" data-target="#delivery_date_Modal" value="Select" /> <input type="text" class="openDatePicker" name="" id="datepicker" placeholder="Select Year" value="<?php echo date('Y'); ?>"> <select style="margin-left: 9px;padding-top: 2px;padding-bottom: 3px;cursor:pointer;" onchange="select_month();" id="select_month_id"> <option value="<?php echo '1'; ?>" <?php if('1' == date('m')) {echo "selected";}?>>January</option> <option value="<?php echo '2'; ?>" <?php if('2' == date('m')) {echo "selected";}?>> February</option> <option value="<?php echo '3'; ?>" <?php if('3' == date('m')) {echo "selected";}?>>March</option> <option value="<?php echo '4'; ?>" <?php if('4' == date('m')) {echo "selected";}?>>April</option> <option value="<?php echo '5'; ?>" <?php if('5' == date('m')) {echo "selected";}?>>May</option> <option value="<?php echo '6'; ?>" <?php if('6' == date('m')) {echo "selected";}?>>June</option> <option value="<?php echo '7'; ?>" <?php if('7' == date('m')) {echo "selected";}?>>July</option> <option value="<?php echo '8'; ?>" <?php if('8' == date('m')) {echo "selected";}?>>August</option> <option value="<?php echo '9'; ?>" <?php if('9' == date('m')) {echo "selected";}?>>September</option> <option value="<?php echo '10'; ?>" <?php if('10' == date('m')) {echo "selected";}?>>October</option> <option value="<?php echo '11'; ?>" <?php if('11' == date('m')) {echo "selected";}?>>November</option> <option value="<?php echo '12'; ?>" <?php if('12' == date('m')) {echo "selected";}?>>December</option> </select> --> <input type="hidden" id="usertype" class="usertype" value="<?php echo $usertype; ?>" > <input type="hidden" id="delete_id" class="delete_id" value="<?php if(empty($access_row)){ } else { echo $access_row->delete_id; } ?>" > <input type="hidden" id="insert_id" class="insert_id" value="<?php if(empty($access_row)){ } else { echo $access_row->insert_id; } ?>" > <input type="hidden" id="preview_id" class="preview_id" value="<?php if(empty($access_row)){ } else { echo $access_row->preview_id; } ?>" > <input type="hidden" id="edit_id" class="edit_id" value="<?php if(empty($access_row)){ } else { echo $access_row->edit_id; } ?>" > <input type="hidden" id="approval_id" class="approval_id" value="<?php if(empty($access_row)){ } else { echo $access_row->approval_id; } ?>" > <input type="hidden" value="<?php echo $ref; ?>" id="ref_id" > <input type="hidden" value="<?php echo $url_val; ?>" id="url_ref" style="width: 230px;" > <!-- <input type="button" value="Add" onclick='add_orders();'> --> <!-- END PAGE HEADER--> <!-- BEGIN DASHBOARD STATS --> <!-- Modal --> <!--<div class="caption"> <i class="fa fa-globe" style="border:1px solid"></i>Transaction Input details </div>--> <form action="" method="post" class="transfer_modal_application"> <div class="row"> <div class="col-sm-12"> <div class="portlet box blue"> <div class="portlet-title"> <div class="caption" style="color:black;"> </div> </div> <div class="portlet-body"> <div class="table-scrollable"> <?php $i=0; $j=0; $k = 0; if(count($result) == 0){ ?> <h2>Not Planned Yet....</h2> <?php return; } foreach($result as $r){ $i++; $table_id = "added_warp_Rows".$i; $table_class = "case_class".$i; $total_case_id = 'total_case'.$i; $q=$r->quantity; $c=$r->piececase; if($c==0){ $n=1; }else{ $n=$q/$c; } ?> <table id="tab" class="table table-striped table-bordered table-hover" style="color:black;"> <tbody id= <?php echo $table_id; ?> > <?php for($j=0;$j<=$n;$j++){ //echo $n; $box="boxdimen".$i.$j; ?> <?php if($j==0){ ?> <tr id="m"> <td style="width:5%;"><b>Sl No</b></td> <td style="width:5%;"><b>OslNo</b></td> <td style="width:5%;"><b>SubOrderType</b></td> <td style="width:5%;"><b>Width</b></td> <td style="width:5%;"><b>ArticleNo</b></td> <td style="width:5%;"><b>Design</b></td> <td style="width:5%;"><b>BuyerShade</b></td> <td style="width:5%;"><b>ShadeName</b></td> <td style="width:5%;"><b>Quantity</b></td> <td style="width:5%;"><b>Total Case Qnty</b></td> </tr> <tr id="m"> <td style="width:5%;"><?php echo $i; ?></td> <input type="hidden" value="<?php echo $r->id; ?>" readonly> <td style="width:5%;"><?php echo $r->oslNo; ?> </td> <td style="width:5%;"><?php echo $r->subOrderType; ?> </td> <td style="width:5%;"><?php echo $r->width; ?> </td> <td style="width:5%;"><?php echo $r->articleNo; ?> </td> <td style="width:5%;" ><?php echo $r->design; ?> </td> <td style="width:5%;" ><?php echo $r->buyerShade; ?> </td> <td style="width:5%;"><?php echo $r->shadeName; ?> </td> <td style="width:5%;"><?php echo $r->quantity; ?> </td> <td style="width:5%;" id = <?php echo $total_case_id; ?>><?php echo $r->piececase; ?> </td> <td style="width:5%;" ><a id="addButton" class="btn blue addButton" onclick="addMore_weft_Rows(<?php echo $r->id; ?>,<?php echo $i; ?>);"><i class="fa fa-plus"></i></a></td> </tr> <tr id="m"> <td colspan='4' width = "20%"></td> <td style="width:6%;"><b>Case Qty</b></td> <td style="width:6%;"><b>Net Wt</b></td> <td style="width:6%;"><b>Gross Wt</b></td> <td style="width:6%;"><b>Box Dimension</b></td> <td style="width:6%;"><b>Sequence</b></td> </tr> <?php } else{ $k++; $tab = 'closet_weft_row'.$k; $tab1 = 'removeButtonn'.$k; ?> <tr id =<?php echo $tab; ?> > <input type="hidden" value="<?php echo $i; ?>" readonly> <input type="hidden" name="ref_id[]" id="ref_id" value="<?php echo $r->id; ?>" readonly> <input type="hidden" name="oslno[]" id="oslno" value="<?php echo $r->oslNo; ?>" readonly> <input type="hidden" name="ordertype[]" id="ordertype" value="<?php echo $r->subOrderType; ?>" readonly> <input type="hidden" name="width[]" id="" value="<?php echo $r->width; ?>" readonly> <input type="hidden" name="article[]" id="" value="<?php echo $r->articleNo; ?>" readonly> <input type="hidden" name="design[]" id="" value="<?php echo $r->design; ?>" readonly> <input type="hidden" name="buyershade[]" id="" value="<?php echo $r->buyerShade; ?>" readonly> <input type="hidden" name="ssl_shade[]" id="" value="<?php echo $r->shadeName; ?>" readonly> <input type="hidden" name="quty[]" id="" value="<?php echo $r->quantity; ?>" readonly> <input type="hidden" name="customer[]" id="" value="<?php echo $r->fileNo; ?>" readonly> <input type="hidden" name="sku[]" id="" value="<?php echo $r->skuNo; ?>" readonly> <input type="hidden" name="desc[]" id="" value="<?php echo $r->description; ?>" readonly> <input type="hidden" name="composition[]" id="" value="<?php echo $r->composition; ?>" readonly> <input type="hidden" name="hsn_code[]" id="" value="<?php echo $r->hsn_code; ?>" readonly> <input type="hidden" name="dbk_si[]" id="" value="<?php echo $r->dbk_si; ?>" readonly> <input type="hidden" name="p_category[]" id="" value="<?php echo $r->p_category; ?>" readonly> <input type="hidden" name="hs_code[]" id="" value="<?php echo $r->hs_code; ?>" readonly> <input type="hidden" name="customs_declaration[]" id="" value="<?php echo $r->customs_declaration; ?>" readonly> <input type="hidden" name="custom_description[]" id="" value="<?php echo $r->custom_description; ?>" readonly> <input type="hidden" name="buyer_product_name[]" id="" value="<?php echo $r->buyer_product_name; ?>" readonly> <input type="hidden" name="barcode[]" id="" value="<?php echo $r->barcode; ?>" readonly> <input type="hidden" name="vendor_item[]" id="" value="<?php echo $r->vendor_item; ?>" readonly> <td colspan='4' style="width:20%;"></td> <td style="width:6%;"><input type="text" onchange="calculate_total_case()" name="case[]" class = <?php echo $table_class; ?> id="" style="width:70px" value="<?php echo $r->piececase; ?>"></td> <td style="width:6%;"><input type="text" name="net_wt[]" id="" style="width:70px" value="<?php echo $r->net_wt; ?>"></td> <td style="width:6%;"><input type="text" name="gross_wt[]" id="" style="width:70px" value="<?php echo $r->gross_wt; ?>"></td> <td style="width:6%;" > <select id=<?php echo $box; ?> name="boxdimen[]" onclick="boxdimention(<?php echo $i; ?>,<?php echo $j; ?>)"> <option><?php echo $r->box_dimention; ?></option> </select> </td> <td style="width:6%;" ><input type="text" style="width:70px" id="" name="sequence[]"></td> <!-- <td style="width:6%;"><a id="addButton" class="btn blue addButton" onclick="addMore_weft_Rows(<?php echo $r->id; ?>,<?php echo $i; ?>);"><i class="fa fa-plus"></i></a></td> --> <td style="width:6%;"><a id= <?php echo $tab1; ?> class="btn blue addButton" onclick="remove_weft_Row(<?php echo $k; ?>);"> <i class="fa fa-minus"></i></a></td> </tr> <?php } } ?> </tbody> </table> <?php } ?> <input type="hidden" value="<?php echo $k; ?>" id="rowid_val"> <input type="hidden" value="<?php echo $n; ?>" id="row"> <input type="hidden" value="<?php echo $i; ?>" id="row_numbers"> <button type="submit" class="btn btn-primary" id="">Submit</button> <button type="button" class="btn btn-primary" id=""><a href="<?php echo base_url('madeups_billing/index') ?>">Cancel</a></button> </form> </div> </div> </div> </div> </div><!--row 11 end--> </div> </div> <div style="display:none;"><table border="1" style="border-spacing: 0px !important;" id="export_table" class="export_table"></table></div> <div style="display:none;"> <table border="1" style="border-spacing: 0px !important;" id="print_table" class="print_table"></table> </div> <script> var i=20; $( document ).ready(function() { calculate_total_case(); }); function calculate_total_case() { var total_rows = $('#row_numbers').val(); var l = 0; for(l = 1; l <= total_rows; l++){ var sum = 0; $('.case_class'+l).each(function(){ sum += parseFloat(this.value); }); document.getElementById('total_case'+l).innerHTML = sum; } } function addMore_weft_Rows(id, talble_id) { var table = "added_warp_Rows"+talble_id; var i = $('#rowid_val').val(); i++; console.log(i); var content=''; content += '<tr id="closet_weft_row' + i + '">'; content += '<input type="hidden" value="" class="row" style="margin-left:0px;margin-right:0px;border: transparent !important;"> '; content += '<input type="hidden" value="" class="id" name="ref_id[]" id="ref_id' + i + '" style="margin-left:0px;margin-right:0px;border: transparent !important;"readonly>'; content += '<input type="hidden" value="" class="oslno" name="oslno[]" id="oslno' + i + '" style="margin-left:0px;margin-right:0px;border: transparent !important;" readonly>'; content += '<input type="hidden" value="" class="ordertype" name="ordertype[]" id="ordertype'+ i +'" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="width" name="width[]" id="width' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="article" name="article[]" id="article' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="design" name="design[]" id="design' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="buyershade" name="buyershade[]" id="buyershade' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="ssl_shade" name="ssl_shade[]" id="ssl_shade' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="quty" name="quty[]" id="quty' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="customer" name="customer[]" id="customer' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="sku" name="sku[]" id="sku' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="desc" name="desc[]" id="desc' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="composition'+talble_id+'"" name="composition[]" id="composition' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="hsn_code'+talble_id+'"" name="hsn_code[]" id="hsn_code' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="dbk_si'+talble_id+'"" name="dbk_si[]" id="dbk_si' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="p_category'+talble_id+'"" name="p_category[]" id="p_category' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="hs_code'+talble_id+'"" name="hs_code[]" id="hs_code' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="customs_declaration'+talble_id+'"" name="customs_declaration[]" id="customs_declaration' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="custom_description'+talble_id+'"" name="custom_description[]" id="custom_description' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="buyer_product_name'+talble_id+'"" name="buyer_product_name[]" id="buyer_product_name' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="barcode'+talble_id+'"" name="barcode[]" id="barcode' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<input type="hidden" value="" class="vendor_item'+talble_id+'"" name="vendor_item[]" id="vendor_item' + i + '" style="margin-left:0px;margin-right:0px;" readonly>'; content += '<td colspan="4"></td>'; content += '<td style="width:5%;"><input name="case[]" class = "case_class'+talble_id+'" onchange="calculate_total_case()" value="" id="case'+ i +'" type="text" style = "width:70px" ></td>'; content += '<td style="width:5%;"><input name="net_wt[]" value="" id="net_wt'+ i +'" type="text" style = "width:70px"></td>'; content += '<td style="width:5%;"><input name="gross_wt[]" value="" id="gross_wt'+ i +'" type="text" style = "width:70px"></td>'; content += '<td style="width:5%;"><select name="boxdimen[]" value="" id="boxdimen'+ i +talble_id+'" type="text"></select></td>'; content += '<td style="width:5%;"><input name="sequence[]" value="" id="seq'+ i +'" type="text" style = "width:70px"></td>'; content += '<td style="width:5%;"><a id="removeButtonn' + i + '" onclick="remove_weft_Row('+ i +');" class="btn blue addButton"> <i class="fa fa-minus"></i></a> </td>'; content += '</tr>'; $('#rowid_val').val(i); $("#"+table).append(content); $.ajax({ type: "post", url: "<?php echo base_url(); ?>madeups_billing/get_autofill", data:{'id':id,'i':i}, success: function (data) { var objData = jQuery.parseJSON(data); obj=objData.quantity; obj1=objData.delievry_quantity; obj2=objData.i; // obj1=objData.delievry_quantity; obj_emp=objData.emp_loc; $("#ref_id"+i).val(obj.id); $("#oslno"+i).val(obj.oslNo); $("#ordertype"+i).val(obj.subOrderType); $("#width"+i).val(obj.width); $("#article"+i).val(obj.articleNo); $("#design"+i).val(obj.design); $("#buyershade"+i).val(obj.buyerShade); $("#ssl_shade"+i).val(obj.shadeName); $("#quty"+i).val(obj.quantity); $("#net_wt"+i).val(obj.net_wt); $("#gross_wt"+i).val(obj.gross_wt); $("#customer"+i).val(obj.fileNo); $("#sku"+i).val(obj.skuNo); $("#composition"+i).val(obj.composition); $("#hsn_code"+i).val(obj.hsn_code); $("#dbk_si"+i).val(obj.dbk_si); $("#p_category"+i).val(obj.p_category); $("#hs_code"+i).val(obj.hs_code); $("#customs_declaration"+i).val(obj.customs_declaration); $("#custom_description"+i).val(obj.custom_description); $("#buyer_product_name"+i).val(obj.buyer_product_name); $("#barcode"+i).val(obj.barcode); $("#vendor_item"+i).val(obj.vendor_item); $("#desc"+i).val(obj.description); // $("#boxdimen"+i).val(obj.box_dimention); h=obj.box_dimention; $("#case"+i).val(obj.piececase); var content = ''; content += '<option>'+ h +'</option>'; $.each(obj1,function(key,val) { //alert(val.yarnSpecification); content += '<option>'+val.box_dimention+'</option>'; }); $('#boxdimen'+ i+talble_id).html(content); calculate_total_case(); } }); } function remove_weft_Row(removeNum) { $('#removeButtonn'+ removeNum).closest('#closet_weft_row'+ removeNum).remove(); calculate_total_case(); // alert(removeNum); } $('.transfer_modal_application').submit(function(e){ // alert('hii'); e.preventDefault(); formdata = new FormData($(this)[0]); $.ajax({ url:"<?php echo base_url('madeups_billing/add_suborder_form');?>", type:"POST", data: formdata, contentType: false, processData: false, success:function(data){ var data=jQuery.parseJSON(data); if(data.result==1){ console.log(data); alert('SuccessFullyAdded'); window.location.href = '<?php echo base_url('madeups_billing');?>/'; }else{ alert('SomethingWentWrong'); } } }); }); function boxdimention(k,j){ var t='boxdimen'+k+j; // alert(t); $.ajax({ type:'post', url:'<?php echo base_url("madeups_billing/madeus_box_data"); ?>', data:'', async:false, success: function (response12) { response12 = jQuery.parseJSON(response12); console.log(response12); for(var i=0; i<response12.length; i++){ var mode = ''; mode +='<option>'+response12[i].box_dimention+'</option>'; $('#'+t).append(mode); } } }); } </script>