From 8a1f14ef39e6dbbf5407c09773dd4b95de109942 Mon Sep 17 00:00:00 2001 From: "venbatechnologies@gmail.com" Date: Mon, 4 Jun 2018 10:14:10 +0530 Subject: [PATCH] stock issue fix --- application/controllers/batchcard.php | 5 +- application/views/FinalProduct.php | 86 +++++++++++++++++++- application/views/editFinalProduct.php | 52 ++++++++++-- application/views/editmaterialadjustment.php | 9 +- application/views/materialadjustment.php | 2 +- 5 files changed, 140 insertions(+), 14 deletions(-) diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index f18e6d50..a17a7818 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -1540,6 +1540,9 @@ class batchcard extends BaseController $product_value = $this->input->post('values'); $createdby = $this->session->userdata('userId'); + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + $final_master =array('MaterialCode'=>$final_product,'Quantity'=>$final_qty,'Price'=>$product_value,'CreatedBy'=>$createdby,'ProductDate'=>$product_date); @@ -1728,7 +1731,7 @@ class batchcard extends BaseController - + echo "Updated Successfully"; } diff --git a/application/views/FinalProduct.php b/application/views/FinalProduct.php index d37769c0..e66e8c8d 100644 --- a/application/views/FinalProduct.php +++ b/application/views/FinalProduct.php @@ -1254,7 +1254,21 @@ function addHidden(theForm, key, value) $('.addraw').click(function() -{ +{ + +if($('#rawmaterialcode').val()=='0') +{ + alert("Please Select Material"); + return false; +} + +else if($('#rawSupplier').val()=='0') +{ + alert("Please Select Supplier"); + return false; +} + + else{ var rawmaterialcode= $('#rawmaterialcode').val(); var rawSupplierID = $('#rawSupplier').val(); var rawQty = $('#rawqty').val(); @@ -1282,6 +1296,7 @@ $('.addraw').click(function() $('#rawqty').val(''); $('#rawprice').val('') $('#RawRow').val(temp) + } }); @@ -1329,6 +1344,22 @@ $('.EditItem').click(function() $('.rootaddClick').click(function() { + if($('#consumaterialcode').val()=='0') + { + alert("Please Select Material"); + return false; + } + + else if($('#consuSupplier').val()=='0') + { + alert("Please Select Suppliers"); + return false; + } + + + + + else{ var consumaterialcode= $('#consumaterialcode').val(); var consuSupplierID = $('#consuSupplier').val(); @@ -1354,6 +1385,7 @@ $('.rootaddClick').click(function() $('#consuqty').val(''); $('#consuprice').val(''); $('#ConsuRow').val(temp); + } }); @@ -1402,7 +1434,22 @@ $('.rootEditItem').click(function() $('.CounteraddClick').click(function() { + + if($('#packumaterialcode').val()=='0') + { + alert("Please Select Material"); + return true; + } + + else if($('#packSupplier').val()=='0') + { + alert("Please Select Supplier"); + return true; + + } + + else{ var packmaterialcode= $('#packumaterialcode').val(); var packSupplierID = $('#packSupplier').val(); var packQty = $('#packqty').val(); @@ -1427,6 +1474,7 @@ $('.CounteraddClick').click(function() $('#packqty').val(''); $('#packprice').val(''); $('#PkgRow').val(temp); + } }); @@ -1485,6 +1533,14 @@ $('.CounterEditItem').click(function() $('.CoaddClick').click(function() { + + if($('#coproduct_id').val()=='0') + { + alert('Please Select Product'); + return false; + } + + else{ var copmaterialcode= $('#coproduct_id').val(); var copDate = $('#CopDate').val(); @@ -1511,6 +1567,7 @@ $('.CoaddClick').click(function() $('#Coqty').val(''); $('#Coprice').val(''); $('#CopRow').val(temp); + } }); @@ -2228,6 +2285,31 @@ function EditResultantQty(materialtype) function Save() { + if($('#DEPTFN').val()=="0") + { + alert("Please Select Product"); + return false; + } + + else if($('#Date').val()=="") + { + alert("Please Select Date"); + return false; + } + + else if($('#Quantity').val()=="") + { + alert("Please Enter Quantity"); + return false; + } + else if($('#values').val()=="") + { + alert("Please Enter Price"); + return false; + } + +else{ + $('#content').loader('show'); $.ajax({ @@ -2252,6 +2334,8 @@ function Save() } }); + + } } diff --git a/application/views/editFinalProduct.php b/application/views/editFinalProduct.php index a4498e53..0c97c8d9 100644 --- a/application/views/editFinalProduct.php +++ b/application/views/editFinalProduct.php @@ -422,6 +422,11 @@ $(function() { + + + + + @@ -676,6 +681,10 @@ $(function() { + + + + @@ -892,7 +901,7 @@ $(function() { S.No Material Code - + Supplier Quantity Price @@ -906,7 +915,7 @@ $(function() { MaterialCode?> - + SupplierID."-".$pac->SupplierName?> Quantity?> Price?> @@ -920,6 +929,8 @@ $(function() { + + @@ -1153,9 +1164,18 @@ $(function() { ?> - + - + + + + + + format('d-m-Y'); + echo $CreatedDate; ?> + + + @@ -1165,6 +1185,8 @@ $(function() { + + @@ -1317,11 +1339,12 @@ $('.addraw').click(function() { var rawmaterialcode= $('#rawmaterialcode').val(); var rawSupplierID = $('#rawSupplier').val(); + //var suppliername = $('#rawsuppliername').val(); var rawQty = $('#rawqty').val(); var rawprice = $('#rawprice').val(); var rawsuppliername = rawSupplier.options[rawSupplier.selectedIndex].text; - //alert(rawsuppliername); + // alert(suppliername); index = parseInt(index)+1; var temp = index @@ -1339,6 +1362,7 @@ $('.addraw').click(function() addHidden(theForm,"rawQty"+temp,rawQty); addHidden(theForm,"rawprice"+temp,rawprice); addHidden(theForm,"type"+temp,"Raw Material"); + addHidden(theForm,"rawSuppliername"+temp,rawsuppliername); $('#rawmaterialcode').val(''); $('#rawSupplier').val(''); @@ -1380,8 +1404,11 @@ $('.EditItem').click(function() //alert("tr"+tr) //var cellval = tr.cells; + var suppliername=$('#rawSuppliername'+userid).val(); + //alert(suppliername); + document.getElementById('rawmaterialedit'+userid).innerHTML = rawmaterialcode; - document.getElementById('rawsuppliername'+userid).innerHTML = rawSupplierID; + document.getElementById('rawsuppliername'+userid).innerHTML = rawSupplierID+"-"+suppliername; document.getElementById('rawQuantiy'+userid).innerHTML = rawQty; document.getElementById('rawmaterialPrice'+userid).innerHTML = rawprice; @@ -1422,6 +1449,7 @@ $('.rootaddClick').click(function() addHidden(theForm,"consumeQty"+temp,consuQty); addHidden(theForm,"consumeprice"+temp,consuprice); addHidden(theForm,"consumetype"+temp,"Consumable"); + addHidden(theForm,"consumeSuppliername"+temp,rawsuppliername); $('#consumaterialcode').val(''); $('#consuSupplier').val(''); @@ -1454,6 +1482,7 @@ $('.rootEditItem').click(function() var editrawprice = $('#Editconsuprice').val(); var tr= document.getElementById(rootuserid); + var supname = $('#consumeSuppliername'+rootuserid).val(); // var cellval = tr.cells; // cellval[1].innerHTML = editconsumaterialcode; // cellval[2].innerHTML = editconsuSupplierID; @@ -1462,7 +1491,7 @@ $('.rootEditItem').click(function() document.getElementById('consumaterial'+rootuserid).innerHTML = editconsumaterialcode; - document.getElementById('consusuppliername'+rootuserid).innerHTML = editconsuSupplierID; + document.getElementById('consusuppliername'+rootuserid).innerHTML = editconsuSupplierID+"-"+supname; document.getElementById('consuQuantiy'+rootuserid).innerHTML = editconsuQty; document.getElementById('consumaterialPrice'+rootuserid).innerHTML = editrawprice; @@ -1497,6 +1526,7 @@ $('.CounteraddClick').click(function() addHidden(theForm,"packQty"+temp,packQty); addHidden(theForm,"packprice"+temp,packprice); addHidden(theForm,"packtype"+temp,"Packaging"); + addHidden(theForm,"packSuppliernamee"+temp,packsuppliername); $('#packumaterialcode').val(''); $('#packSupplier').val(''); @@ -1536,6 +1566,7 @@ $('.CounterEditItem').click(function() var tr= document.getElementById(cuserid); //var cellval = tr.cells; //alert(cuserid) + var supple = $('#packSuppliernamee'+cuserid).val(); // cellval[1].innerHTML = editpackmaterialcode; // cellval[2].innerHTML = editpacksuppliername; @@ -1545,7 +1576,7 @@ $('.CounterEditItem').click(function() document.getElementById('packmaterial'+cuserid).innerHTML = editpackmaterialcode; - document.getElementById('packsuppliername'+cuserid).innerHTML = editpackSupplierID; + document.getElementById('packsuppliername'+cuserid).innerHTML = editpackSupplierID+"-"+supple; document.getElementById('packQuantiy'+cuserid).innerHTML = editpackQty; document.getElementById('packmaterialPrice'+cuserid).innerHTML = editpackprice; @@ -1581,6 +1612,7 @@ $('.CoaddClick').click(function() addHidden(theForm,"CopQty"+temp,copQty); addHidden(theForm,"Copprice"+temp,copprice); addHidden(theForm,"Coptype"+temp,"CoProduct"); + addHidden(theForm,"Copmaterialname"+temp,copsuppliername) $('#coproduct_id').val(''); $('#CopDate').val(''); @@ -1622,6 +1654,8 @@ $('.CoEditItem').click(function() var tr= document.getElementById(cuserid); //var cellval = tr.cells; //alert(cuserid) + + var prname = $('#Copmaterialname'+cuserid).val(); // cellval[1].innerHTML = editcopproduct; // cellval[2].innerHTML = editcopdate; @@ -1629,7 +1663,7 @@ $('.CoEditItem').click(function() // cellval[4].innerHTML = editcopprice; - document.getElementById('Copmaterial'+cuserid).innerHTML = editcoproductid; + document.getElementById('Copmaterial'+cuserid).innerHTML = editcoproductid+"-"+prname; document.getElementById('Copsuppliername'+cuserid).innerHTML = newdate; document.getElementById('CopQuantiy'+cuserid).innerHTML = editcopqty; document.getElementById('CopmaterialPrice'+cuserid).innerHTML = editcopprice; diff --git a/application/views/editmaterialadjustment.php b/application/views/editmaterialadjustment.php index 2287315e..c036d0b7 100644 --- a/application/views/editmaterialadjustment.php +++ b/application/views/editmaterialadjustment.php @@ -16,7 +16,7 @@ if(!empty($materailAdjustmentlist)) { $editid = $mat->AdjustmentId; $supplier = $mat->SupplierID; - $suppliername=$mat->SupplierName; + $suppliername=$mat->SupplierName; $materialcode = $mat->MaterialCode; $date = $mat->CreatedOn; $editquantity= $mat->Quantity; @@ -24,6 +24,7 @@ if(!empty($materailAdjustmentlist)) // $edit_Adjustable_qty= ''; $edit_Description= $mat->Description; + $edit_reason= $mat->Reason; } } @@ -237,7 +238,7 @@ $(function() {
'Select'); + $options = array("0"=>'Select',"1"=>'Stock on fire',"2"=>'Stolen goods',"3"=>'Damaged Goods',"4"=>'Stock written off',"5"=>'Stock taking results',"6"=>'Inventory revaluation'); // if(!empty($PONO)) // { @@ -304,6 +305,10 @@ $(function() {