diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index e2d592cb..91c52fad 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -19,6 +19,7 @@ class batchcard extends BaseController parent::__construct(); $this->load->model('batchcard_model'); $this->load->model('inwardgateregister_model'); + $this->load->model('rawmaterialdetails_model'); $this->isLoggedIn(); $this->load->helper(array('form','url')); date_default_timezone_set('Asia/Kolkata'); @@ -1283,8 +1284,8 @@ class batchcard extends BaseController $data['Pack_material'] = $this->batchcard_model->get_packmaterials(); $data['supplier'] = $this->batchcard_model->getSupplierlist(); $data['stock_value'] = $this->batchcard_model->getStockValue(); - - //print_r($data['allhourdata']);die(); + $data['Records'] = $this->rawmaterialdetails_model->reOrderListing(); + $this->global['pageTitle'] = 'Siddharth : Finished Product Batch Card'; $this->loadViews("FinalProduct", $this->global,$data,NULL); } @@ -1305,6 +1306,8 @@ class batchcard extends BaseController $data['Pack_material'] = $this->batchcard_model->get_packmaterials(); $data['supplier'] = $this->batchcard_model->getSupplierlist(); $data['stock_value'] = $this->batchcard_model->getStockValue(); + + $data['Records'] = $this->rawmaterialdetails_model->reOrderListing(); $this->global['pageTitle'] = 'Siddharth : Finished Product Batch Card'; @@ -2036,16 +2039,16 @@ class batchcard extends BaseController if(count($checkpackid)>0) { - // $this->batchcard_model->update_finalcoproduct($coparray,$coplineId); - // $finalHistoryupdate = $this->batchcard_model->UpdateFinalHistory($copfinal_history,$FPID,$copmaterial); + $this->batchcard_model->update_finalcoproduct($coparray,$coplineId); + $finalHistoryupdate = $this->batchcard_model->UpdateFinalHistory($copfinal_history,$FPID,$copmaterial); } else { - // $this->batchcard_model->save_finalcoproduct($coparray); - // $final_cophistory_save= $this->batchcard_model->SaveFinalHistory($copfinal_history); + $this->batchcard_model->save_finalcoproduct($coparray); + $final_cophistory_save= $this->batchcard_model->SaveFinalHistory($copfinal_history); } } } diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index 066ceeea..82d40530 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -727,7 +727,7 @@ and MaterialCode=? and SupplierID=? ),0) as ReduceQty from T_Material_stock_hist and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; $query = $this->db->query($subQuery,array($MaterialCode,$Supplier,$MaterialCode,$Supplier,$MaterialCode,$startdate,$newdate,$Supplier)); - //print_r($this->db->last_query()); + print_r($this->db->last_query()); return $query->result_array(); diff --git a/application/views/FinalProduct.php b/application/views/FinalProduct.php index 2baa9438..faa01f62 100644 --- a/application/views/FinalProduct.php +++ b/application/views/FinalProduct.php @@ -128,40 +128,51 @@ $(function() { -
+
'Date','value' => set_value('Date',$CurrentDate),'id'=>'Date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); echo form_input($data); ?>
-
+
'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); - // echo form_input($data); - $data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true'); + + $data = array('name' => 'Quantity','value' => set_value('Quantity'),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true','onchange'=>'GetBasicvalue();'); echo form_input($data); ?>
-
+
'PlaceOforigin','value' => set_value('PlaceOforigin'),'id'=>'PlaceOforigin', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); - // echo form_input($data); - $data = array('name' => 'values','value' => set_value('values'),'id'=>'values', 'class' => 'form-control' ,'required' => 'true'); + + $data = array('name' => 'values','value' => set_value('values'),'id'=>'values', 'class' => 'form-control' ,'required' => 'true','onchange'=>'GetBasicvalue();'); echo form_input($data); ?>
+ + + +
+ +
+ 'basicvalue','value' => set_value('basicvalue'),'id'=>'basicvalue', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+ +
@@ -416,9 +427,12 @@ $(function() { Supplier Quantity Price + Basic Price Action + + @@ -428,6 +442,18 @@ $(function() {
+
+
+ Total +
+ +
+ + +
+ + +
Consumables
@@ -668,6 +694,7 @@ $(function() { Supplier Quantity Price + Basic Price Action @@ -675,12 +702,28 @@ $(function() { +
+ + +
+
+ Total +
+ +
+ + +
+ + +
+
Packing Material
@@ -918,6 +961,7 @@ $(function() { Supplier Quantity Price + Basic Price Action @@ -925,12 +969,27 @@ $(function() { +
+
+
+ Total +
+ +
+ + +
+ + +
+ + @@ -1151,6 +1210,7 @@ $(function() { Date Quantity Price + Basic Price Action @@ -1158,6 +1218,7 @@ $(function() { + @@ -1165,6 +1226,18 @@ $(function() {
+
+
+ Total +
+ +
+ + +
+ + +
@@ -1196,6 +1269,7 @@ $(function() { <%=Supplier%> <%=Quantity%> <%=Price%> +<%=rawBasicPrice%> @@ -1215,6 +1289,7 @@ $(function() { <%=Supplier%> <%=Quantity%> <%=Price%> +<%=consuBasicPrice%>     @@ -1231,6 +1306,7 @@ $(function() { <%=Supplier%> <%=Quantity%> <%=Price%> +<%=packBasicPrice%> @@ -1249,6 +1325,7 @@ $(function() { <%=Date%> <%=Quantity%> <%=Price%> +<%=CopBasicPrice%> @@ -1273,6 +1350,8 @@ var counteruserid = ''; var stock = ; //console.log(stock); +var lowstock =; + function addHidden(theForm, key, value) @@ -1309,7 +1388,11 @@ else if($('#rawSupplier').val()<='0') var rawprice = $('#rawprice').val(); var rawsuppliername = rawSupplier.options[rawSupplier.selectedIndex].text; var temp = index -var rawmaterialname =""; + var rawmaterialname =""; + + var rawbasic = parseFloat(rawQty) *parseFloat(rawprice); + + // var rawmaterialname = rawmaterialcode.options[rawmaterialcode.selectedIndex].text; //alert(rawsuppliername); @@ -1320,7 +1403,7 @@ var rawmaterialname =""; var template = jQuery("#rawmateriallist").html(); // alert(template) - $('#rawappend').append(_.template(template,{index:temp,Material:rawmaterialname,Supplier:rawsuppliername,Quantity:rawQty,Price:rawprice})); + $('#rawappend').append(_.template(template,{index:temp,Material:rawmaterialname,Supplier:rawsuppliername,Quantity:rawQty,Price:rawprice,rawBasicPrice:rawbasic})); var theForm = $(".final_product"); @@ -1330,6 +1413,17 @@ var rawmaterialname =""; addHidden(theForm,"rawprice"+temp,rawprice); addHidden(theForm,"type"+temp,"Raw Material"); + addHidden(theForm,"rawbasic"+temp,rawbasic); +var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#rawbasic"+i).val()); + } + + $('#rawtotal').val(total); + + + $('#rawmaterialcode').val("0"); $('rawmaterialcode').select2("val", null); @@ -1379,6 +1473,10 @@ $('.EditItem').click(function() var rawQty = $('#Editrawqty').val(); var rawprice = $('#Editrawprice').val(); + var rawbasic = parseFloat(rawQty) *parseFloat(rawprice); + + var rawrow = $('#RawRow').val(); + var e = document.getElementById("Editrawmaterialcode"); var rawmaterialname = e.options[e.selectedIndex].text; @@ -1393,12 +1491,30 @@ $('.EditItem').click(function() cellval[3].innerHTML = rawQty; cellval[4].innerHTML = rawprice; + cellval[5].innerHTML = rawbasic; + $('#rawmaterialcode'+userid).val(rawmaterialcode); $('#rawSupplierID'+userid).val(rawSupplierID); $('#rawQty'+userid).val(rawQty); $('#rawprice'+userid).val(rawprice); + $('#rawbasic'+userid).val(rawbasic); + + var total = 0; + for(var i=1;i<=rawrow;i++) + { + total = parseFloat(total) + parseFloat($("#rawbasic"+i).val()); + //console.log(total) + + var aa = $('#rawbasic'+i).val(); + } + +// console.log(total) + $('#rawtotal').val(total); + + + } @@ -1429,6 +1545,8 @@ $('.rootaddClick').click(function() var consuQty = $('#consuqty').val(); var consuprice = $('#consuprice').val(); var rawsuppliername = consuSupplier.options[consuSupplier.selectedIndex].text; + + var conbasic = parseFloat(consuprice) * parseFloat(consuQty); var g = document.getElementById("consumaterialcode"); var consumaterialname = g.options[g.selectedIndex].text; @@ -1440,7 +1558,7 @@ $('.rootaddClick').click(function() rootindex = parseInt(rootindex)+1; var template = jQuery("#consumable").html(); //alert(template) - $('#consuappend').append(_.template(template,{rootindex:temp,Material:consumaterialname,Supplier:rawsuppliername,Quantity:consuQty,Price:consuprice})); + $('#consuappend').append(_.template(template,{rootindex:temp,Material:consumaterialname,Supplier:rawsuppliername,Quantity:consuQty,Price:consuprice,consuBasicPrice:conbasic})); var theForm = $(".final_product"); @@ -1450,6 +1568,17 @@ $('.rootaddClick').click(function() addHidden(theForm,"consumeprice"+temp,consuprice); addHidden(theForm,"consumetype"+temp,"Consumable"); + + + addHidden(theForm,"conbasic"+temp,conbasic); +var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#conbasic"+i).val()); + } + + $('#consutotal').val(total); + $('#consumaterialcode').val(''); $('#consuSupplier').val(''); $('#consuqty').val(''); @@ -1498,6 +1627,9 @@ $('.rootEditItem').click(function() var editconsuQty = $('#Editconsuqty').val(); var editrawprice = $('#Editconsuprice').val(); + var consrow = $('#ConsuRow').val(); + var conbasic = parseFloat(editrawprice) * parseFloat(editconsuQty); + var h = document.getElementById("Editconsumaterialcode"); var editconsumaterialname = h.options[h.selectedIndex].text; @@ -1517,12 +1649,28 @@ $('.rootEditItem').click(function() document.getElementById('consuQuantiy'+rootuserid).innerHTML = editconsuQty; document.getElementById('consumaterialPrice'+rootuserid).innerHTML = editrawprice; + document.getElementById('consumaterialbasic'+rootuserid).innerHTML = conbasic; + $('#consumematerialcode'+rootuserid).val(editconsumaterialcode); $('#consumeSupplierID'+rootuserid).val(editconsuSupplierID); $('#consumeQty'+rootuserid).val(editconsuQty); $('#consumeprice'+rootuserid).val(editrawprice); + + $('#conbasic'+rootuserid).val(conbasic); + + var total = 0; + for(var i=1;i<=consrow;i++) + { + total = parseFloat(total) + parseFloat($("#conbasic"+i).val()); + //console.log(total) + } + +// console.log(total) + $('#consutotal').val(total); + + } }); @@ -1551,6 +1699,9 @@ $('.CounteraddClick').click(function() var packprice = $('#packprice').val(); var packsuppliername = packSupplier.options[packSupplier.selectedIndex].text; + + var packBasic = parseFloat(packQty)*parseFloat(packprice); + var j = document.getElementById("packumaterialcode"); var packmaterilalname = j.options[j.selectedIndex].text; @@ -1559,7 +1710,7 @@ $('.CounteraddClick').click(function() counterindex = parseInt(counterindex)+1; var template = jQuery("#packable").html(); //alert(template) - $('#packappend').append(_.template(template,{counterindex:temp,Material:packmaterilalname,Supplier:packsuppliername,Quantity:packQty,Price:packprice})); + $('#packappend').append(_.template(template,{counterindex:temp,Material:packmaterilalname,Supplier:packsuppliername,Quantity:packQty,Price:packprice,packBasicPrice:packBasic})); var theForm = $(".final_product"); @@ -1569,6 +1720,20 @@ $('.CounteraddClick').click(function() addHidden(theForm,"packprice"+temp,packprice); addHidden(theForm,"packtype"+temp,"Packaging"); + + addHidden(theForm,"pacbasic"+temp,packBasic); + var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#pacbasic"+i).val()); + } + + $('#packtotal').val(total); + + + + + $('#packumaterialcode').val(''); $('#packSupplier').val(''); $('#packqty').val(''); @@ -1620,7 +1785,12 @@ $('.CounterEditItem').click(function() var editpackprice = $('#Editpackprice').val(); var editpacksuppliername = EditpackSupplier.options[EditpackSupplier.selectedIndex].text; + var editpackbasic = parseFloat(editpackQty)* parseFloat(editpackprice); + var packrow = $('#PkgRow').val(); + + // console.log(editpackbasic); + //console.log(cuserid); var k = document.getElementById("Editpackumaterialcode"); var editpackmaterilalname = k.options[k.selectedIndex].text; @@ -1645,12 +1815,26 @@ $('.CounterEditItem').click(function() document.getElementById('packQuantiy'+cuserid).innerHTML = editpackQty; document.getElementById('packmaterialPrice'+cuserid).innerHTML = editpackprice; + document.getElementById('packmaterialbasic'+cuserid).innerHTML = editpackbasic; + $('#packmaterialcode'+cuserid).val(editpackmaterialcode); $('#packSupplierID'+cuserid).val(editpackSupplierID); $('#packQty'+cuserid).val(editpackQty); $('#packprice'+cuserid).val(editpackprice); + + + + $('#pacbasic'+cuserid).val(editpackbasic); + + var total = 0; + for(var i=1;i<=packrow;i++) + { + total = parseFloat(total) + parseFloat($("#pacbasic"+i).val()); + } + + $('#packtotal').val(total); } @@ -1670,12 +1854,14 @@ $('.CoaddClick').click(function() var copmaterialcode= $('#coproduct_id').val(); var copDate = $('#CopDate').val(); - var newdate = copDate.split("-").reverse().join("-"); + var newdate = copDate.split("-").reverse().join("-"); var copQty = $('#Coqty').val(); var copprice = $('#Coprice').val(); var copsuppliername = coproduct_id.options[coproduct_id.selectedIndex].text; -var m = document.getElementById("coproduct_id"); + var copbasic = parseFloat(copQty) * parseFloat(copprice); + + var m = document.getElementById("coproduct_id"); var copproduct = m.options[m.selectedIndex].text; @@ -1683,7 +1869,7 @@ var m = document.getElementById("coproduct_id"); coproductindex = parseInt(coproductindex)+1; var template = jQuery("#coproduct").html(); //alert(copsuppliername) - $('#coproductappend').append(_.template(template,{coproductindex:temp,Material:copproduct,Date:copDate,Quantity:copQty,Price:copprice})); + $('#coproductappend').append(_.template(template,{coproductindex:temp,Material:copproduct,Date:copDate,Quantity:copQty,Price:copprice,CopBasicPrice:copbasic})); var theForm = $(".final_product"); @@ -1693,6 +1879,18 @@ var m = document.getElementById("coproduct_id"); addHidden(theForm,"Copprice"+temp,copprice); addHidden(theForm,"Coptype"+temp,"CoProduct"); + + + addHidden(theForm,"copbasic"+temp,copbasic); + var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#copbasic"+i).val()); + } + + $('#coptotal').val(total); + + $('#coproduct_id').val(''); $('#CopDate').val(''); $('#Coqty').val(''); @@ -1744,6 +1942,8 @@ $('.CoEditItem').click(function() var editcopprice = $('#EditCoprice').val(); var editcopproduct = Editcoproduct_id.options[Editcoproduct_id.selectedIndex].text; + var copbasic = parseFloat(editcopqty)*parseFloat(editcopprice); + var coprow = $('#CopRow').val(); var n = document.getElementById("Editcoproduct_id"); var editcopproduct = n.options[n.selectedIndex].text; @@ -1762,11 +1962,26 @@ $('.CoEditItem').click(function() document.getElementById('CopQuantiy'+cuserid).innerHTML = editcopqty; document.getElementById('CopmaterialPrice'+cuserid).innerHTML = editcopprice; + document.getElementById('Copmaterialbasic'+cuserid).innerHTML = copbasic; + $('#Copmaterialcode'+cuserid).val(editcoproductid); $('#CopDate'+cuserid).val(newdate); $('#CopQty'+cuserid).val(editcopqty); $('#Copprice'+cuserid).val(editcopprice); + + $('#copbasic'+cuserid).val(copbasic); + + var total = 0; + for(var i=1;i<=coprow;i++) + { + total = parseFloat(total) + parseFloat($("#copbasic"+i).val()); + } + + $('#coptotal').val(total); + + + } @@ -1774,49 +1989,83 @@ $('.CoEditItem').click(function() +function lowqtycheck(type) +{ + //alert(type) + console.log(lowstock); + var materialcode = ''; + + if(type == 'rawmaterial') + { + materialcode = $('#rawmaterialcode').val(); + } + + if(type == 'consumables') + { + materialcode = $('#consumaterialcode').val(); + } + + if(type == 'packing') + { + materialcode = $('#packumaterialcode').val(); + } + + $.each(lowstock, function(id, obj) { + if(obj.MaterialCode == materialcode) + { + alert('Stock is running Low !! available Stock'+obj.Current_stock); + + } + }); + +} + + + $('#rawmaterialcode').change(function() { + var rawSupplier = $('#rawSupplier').val(); var type = "rawmaterial"; - ResultantQty(type); + lowqtycheck(type); }); -$('#rawSupplier').change(function() -{ - var type = "rawmaterial"; - ResultantQty(type); +// $('#rawSupplier').change(function() +// { +// var type = "rawmaterial"; +// lowqtycheck(type); -}); +// }); $('#consumaterialcode').change(function() { var type = "consumables"; - ResultantQty(type); + lowqtycheck(type); }); -$('#consuSupplier').change(function() -{ - var type = "consumables"; - ResultantQty(type); +// $('#consuSupplier').change(function() +// { +// var type = "consumables"; +// lowqtycheck(type); -}); +// }); $('#packumaterialcode').change(function() { var type = "packing"; - ResultantQty(type); + lowqtycheck(type); }); -$('#packSupplier').change(function() -{ - var type = "packing"; - ResultantQty(type); +// $('#packSupplier').change(function() +// { +// var type = "packing"; +// lowqtycheck(type); -}); +// }); @@ -1826,54 +2075,99 @@ $('#Editrawmaterialcode').change(function() { var type = "rawmaterial"; - EditResultantQty(type); - -}); - -$('#EditrawSupplier').change(function() -{ - - - var type = "rawmaterial"; - EditResultantQty(type); + Editlowqtycheck(type); }); -$('#EditconsuSupplier').change(function() -{ - var type = "consumables"; - EditResultantQty(type); - -}); - $('#Editconsumaterialcode').change(function() { var type = "consumables"; - EditResultantQty(type); + Editlowqtycheck(type); }); -$('#EditpackSupplier').change(function() -{ - var type = "packing"; - EditResultantQty(type); - -}); - $('#Editpackumaterialcode').change(function() { var type = "packing"; - EditResultantQty(type); + Editlowqtycheck(type); }); + + +function Editlowqtycheck(type) +{ + //alert(type) + //console.log(lowstock); + var materialcode = ''; + + if(type == 'rawmaterial') + { + materialcode = $('#Editrawmaterialcode').val(); + } + + if(type == 'consumables') + { + materialcode = $('#Editconsumaterialcode').val(); + } + + if(type == 'packing') + { + materialcode = $('#Editpackumaterialcode').val(); + } + + $.each(lowstock, function(id, obj) { + if(obj.MaterialCode == materialcode) + { + alert('Stock is running Low !! available Stock is '+obj.Current_stock); + + } + }); + +} + + + +// $('#EditrawSupplier').change(function() +// { + + +// var type = "rawmaterial"; +// EditResultantQty(type); + +// }); + + + +// $('#EditconsuSupplier').change(function() +// { +// var type = "consumables"; +// EditResultantQty(type); + +// }); + + + + +// $('#EditpackSupplier').change(function() +// { +// var type = "packing"; +// EditResultantQty(type); + +// }); + + + + + + var today = new Date(); var dd = today.getDate(); var mm = today.getMonth()+1; //January is 0! @@ -3118,78 +3412,29 @@ else{ } -function rawqtycheck() + + +function GetBasicvalue() { - // alert(rawresultqty); + var basic =0; + var qty= $('#Quantity').val(); + var val = $('#values').val(); - // var enterrawqty= $('#rawqty').val(); - // if(rawresultqty < enterrawqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+rawresultqty); - // } + if(qty != '' && val !='') + { + basic = parseFloat(qty)*parseFloat(val); + $('#basicvalue').val(basic); + } + + else + { + //alert('Please Enter Quantity and Value'); + $('#basicvalue').val(0); + } + } -function editrawqtycheck() -{ - //alert(rawresultqty); - - // var editenterrawqty= $('#Editrawqty').val(); - // if(rawresultqty < editenterrawqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+rawresultqty); - // } - -} - - -function consuqtycheck() -{ - // alert(rawresultqty); - - // var enterconsuqty= $('#consuqty').val(); - // if(consuresultant < enterconsuqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+consuresultant); - // } - -} - - -function Editconsuqtycheck() -{ - // var editenterconsuqty= $('#Editconsuqty').val(); - // if(consuresultant < editenterconsuqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+consuresultant); - // } -} - - - -function packqtycheck() -{ - // alert(rawresultqty); - - // var enterpackqty= $('#packqty').val(); - // if(packresultant < enterpackqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+packresultant); - // } - -} - - -function Editpackqtycheck() -{ - // var entereditpackqty = $('#Editpackqty').val(); - // if(packresultant < entereditpackqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+packresultant); - // } -} - - diff --git a/application/views/editFinalProduct.php b/application/views/editFinalProduct.php index 7b6f6532..e5b8332f 100644 --- a/application/views/editFinalProduct.php +++ b/application/views/editFinalProduct.php @@ -5,6 +5,7 @@ $qty = ''; $value = ''; $finProduct = ''; $FPId= ''; +$basicvalue = ''; if(!empty($masterproduct)) { foreach($masterproduct as $ma) @@ -16,6 +17,8 @@ if(!empty($masterproduct)) $value = $ma->Price; $finProduct = $ma->MaterialCode; $FPId = $ma->FPId; + $basicvalue = $qty*$value; + } } @@ -132,38 +135,52 @@ $(function() {
-
+
'Date','value' => set_value('Date',$date),'id'=>'Date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); echo form_input($data); ?>
-
+
'Quantity','value' => set_value('Quantity',$qty),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true'); + $data = array('name' => 'Quantity','value' => set_value('Quantity',$qty),'id'=>'Quantity', 'class' => 'form-control' ,'required' => 'true','onchange'=>'GetBasicvalue();'); echo form_input($data); ?>
-
+
'values','value' => set_value('values',$value),'id'=>'values', 'class' => 'form-control' ,'required' => 'true'); + $data = array('name' => 'values','value' => set_value('values',$value),'id'=>'values', 'class' => 'form-control' ,'required' => 'true','onchange'=>'GetBasicvalue();'); echo form_input($data); ?>
+ + + + +
+ +
+ 'basicvalue','value' => set_value('basicvalue',$basicvalue),'id'=>'basicvalue', 'class' => 'form-control' ,'required' => 'true'); + echo form_input($data); + ?> +
+ +
@@ -401,13 +418,17 @@ $(function() { Supplier Quantity Price + Basic Price Action + $index= $index+1; + $basicPrice = ($raw->Quantity)*($raw->Price); + $rawtotal = $rawtotal+$basicPrice; ?> MaterialCode."-".$raw->MaterialName?> @@ -416,6 +437,12 @@ $(function() { Quantity;?> Price?> + + + + + + @@ -447,6 +474,24 @@ $(function() {
+ + +
+
+ Total +
+ +
+ + +
+ + +
+ + + +
Consumables
@@ -661,14 +706,18 @@ $(function() { Supplier Quantity Price + Basic Price Action + $inde=$inde+1; + $consubasic = ($cou->Quantity)*($cou->Price); + $consubasicTotal = $consubasicTotal+$consubasic; ?> MaterialCode."-".$cou->MaterialName?> @@ -678,6 +727,7 @@ $(function() { Price?> +     @@ -685,6 +735,10 @@ $(function() { + + + + @@ -711,6 +765,22 @@ $(function() {
+ +
+
+ Total +
+ +
+ + +
+ + +
+ + +
Packing Material
@@ -922,14 +992,18 @@ $(function() { Supplier Quantity Price + Basic Price Action + $intt=$intt+1; + $packbasic = ($pac->Quantity)*($pac->Price); + $packbasicTotal = $packbasicTotal+$packbasic;?> @@ -938,12 +1012,17 @@ $(function() { SupplierID."-".$pac->SupplierName?> Quantity?> Price?> +     + + + + @@ -968,7 +1047,18 @@ $(function() {
+
+
+ Total +
+
+ + +
+ + +
@@ -1175,6 +1265,7 @@ $(function() { Date Quantity Price + Basic Price Action @@ -1182,11 +1273,14 @@ $(function() { format('d-m-Y'); + $copbasic = ($dis['Quantity'])*($dis['Price']); + $CopBasicTotal = $CopBasicTotal+ $copbasic; ?> @@ -1206,6 +1300,11 @@ $(function() { + + + + + @@ -1235,6 +1334,20 @@ $(function() { +
+
+ Total +
+ +
+ + +
+ + +
+ + @@ -1267,6 +1380,7 @@ $(function() { <%=Supplier%> <%=Quantity%> <%=Price%> +<%=rawBasicPrice%> @@ -1285,6 +1399,8 @@ $(function() { <%=Supplier%> <%=Quantity%> <%=Price%> + +<%=consuBasicPrice%>     @@ -1302,6 +1418,8 @@ $(function() { <%=Quantity%> <%=Price%> +<%=packBasicPrice%> +     @@ -1320,6 +1438,8 @@ $(function() { <%=Quantity%> <%=Price%> +<%=CopBasicPrice%> +     @@ -1395,6 +1515,8 @@ else if($('#rawSupplier').val()=='0') var e = document.getElementById("rawmaterialcode"); var rawmaterialname = e.options[e.selectedIndex].text; + var rawbasic = parseFloat(rawQty) *parseFloat(rawprice); + // var materialnam=rawmaterialname.substring(0, rawmaterialname.indexOf("-")); // alert(materialnam); @@ -1406,7 +1528,7 @@ else if($('#rawSupplier').val()=='0') var template = jQuery("#rawmateriallist").html(); // alert(template) - $('#rawappend').append(_.template(template,{index:temp,Material:rawmaterialname,Supplier:rawsuppliername,Quantity:rawQty,Price:rawprice})); + $('#rawappend').append(_.template(template,{index:temp,Material:rawmaterialname,Supplier:rawsuppliername,Quantity:rawQty,Price:rawprice,rawBasicPrice:rawbasic})); var theForm = $(".final_product"); @@ -1418,6 +1540,16 @@ else if($('#rawSupplier').val()=='0') addHidden(theForm,"rawSuppliername"+temp,rawsuppliername); addHidden(theForm,"rawmaterialname"+temp,rawmaterialname); + + addHidden(theForm,"rawbasic"+temp,rawbasic); +var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#rawbasic"+i).val()); + } + + $('#rawtotal').val(total); + $('#rawmaterialcode').val(''); $('#rawSupplier').val(''); $('#rawqty').val(''); @@ -1480,7 +1612,12 @@ else{ var rawSupplierID = $('#EditrawSupplier').val(); var rawQty = $('#Editrawqty').val(); var rawprice = $('#Editrawprice').val(); + + var rawbasic = parseFloat(rawQty) *parseFloat(rawprice); + //console.log(rawbasic); + var rawrow = $('#RawRow').val(); + var tr= document.getElementById(userid); //alert("tr"+tr) //var cellval = tr.cells; @@ -1495,17 +1632,38 @@ else{ document.getElementById('rawsuppliername'+userid).innerHTML = rawSupplierID+"-"+suppliername; document.getElementById('rawQuantiy'+userid).innerHTML = rawQty; document.getElementById('rawmaterialPrice'+userid).innerHTML = rawprice; - + + + document.getElementById('rawmaterialbasic'+userid).innerHTML = rawbasic; + + // cellval[1].innerHTML = rawmaterialcode; // cellval[2].innerHTML = rawSupplierID; // cellval[3].innerHTML = rawQty; - // cellval[4].innerHTML = rawprice; + // cellval[5].innerHTML = rawbasic; $('#rawmaterialcode'+userid).val(rawmaterialcode); $('#rawSupplierID'+userid).val(rawSupplierID); $('#rawQty'+userid).val(rawQty); $('#rawprice'+userid).val(rawprice); + + $('#rawbasic'+userid).val(rawbasic) + + + var total = 0; + for(var i=1;i<=rawrow;i++) + { + total = parseFloat(total) + parseFloat($("#rawbasic"+i).val()); + //console.log(total) + } + +//console.log(total) + $('#rawtotal').val(total); + + + + } @@ -1537,6 +1695,8 @@ $('.rootaddClick').click(function() var consuprice = $('#consuprice').val(); var rawsuppliername = consuSupplier.options[consuSupplier.selectedIndex].text; + var conbasic = parseFloat(consuprice) * parseFloat(consuQty); + var g = document.getElementById("consumaterialcode"); var consumaterialname = g.options[g.selectedIndex].text; @@ -1544,7 +1704,7 @@ $('.rootaddClick').click(function() var temp = rootindex var template = jQuery("#consumable").html(); //alert(template) - $('#consuappend').append(_.template(template,{rootindex:temp,Material:consumaterialname,Supplier:rawsuppliername,Quantity:consuQty,Price:consuprice})); + $('#consuappend').append(_.template(template,{rootindex:temp,Material:consumaterialname,Supplier:rawsuppliername,Quantity:consuQty,Price:consuprice,consuBasicPrice:conbasic})); var theForm = $(".final_product"); @@ -1556,6 +1716,16 @@ $('.rootaddClick').click(function() addHidden(theForm,"consumeSuppliername"+temp,rawsuppliername); addHidden(theForm,"consumematerialname"+temp,consumaterialname); + + addHidden(theForm,"conbasic"+temp,conbasic); +var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#conbasic"+i).val()); + } + + $('#consutotal').val(total); + $('#consumaterialcode').val(''); $('#consuSupplier').val(''); $('#consuqty').val(''); @@ -1596,6 +1766,10 @@ $('.rootEditItem').click(function() var editconsuQty = $('#Editconsuqty').val(); var editrawprice = $('#Editconsuprice').val(); + var consubasic = parseFloat(editconsuQty)*parseFloat(editrawprice); + + var consurow = $('#ConsuRow').val(); + var tr= document.getElementById(rootuserid); var supname = $('#consumeSuppliername'+rootuserid).val(); @@ -1613,12 +1787,34 @@ $('.rootEditItem').click(function() document.getElementById('consuQuantiy'+rootuserid).innerHTML = editconsuQty; document.getElementById('consumaterialPrice'+rootuserid).innerHTML = editrawprice; + document.getElementById('consumaterialbasic'+rootuserid).innerHTML = consubasic; + // document.getElementById('rootcause'+rootuserid).innerHTML = editroot; $('#consumematerialcode'+rootuserid).val(editconsumaterialcode); $('#consumeSupplierID'+rootuserid).val(editconsuSupplierID); $('#consumeQty'+rootuserid).val(editconsuQty); $('#consumeprice'+rootuserid).val(editrawprice); + + // $('#consumaterialbasic'+rootuserid).val(consubasic); + + $('#conbasic'+rootuserid).val(consubasic); + + + var total = 0; + for(var i=1;i<=consurow;i++) + { + total = parseFloat(total) + parseFloat($("#conbasic"+i).val()); + //console.log(total) + } + $('#consutotal').val(total); + + + + + + + }); @@ -1650,12 +1846,14 @@ $('.CounteraddClick').click(function() var h = document.getElementById("packumaterialcode"); var packmaterialname = h.options[h.selectedIndex].text; + + var packBasic = parseFloat(packQty)*parseFloat(packprice); counterindex = parseInt(counterindex)+1; var temp = counterindex var template = jQuery("#packable").html(); //alert(template) - $('#packappend').append(_.template(template,{counterindex:temp,Material:packmaterialname,Supplier:packsuppliername,Quantity:packQty,Price:packprice})); + $('#packappend').append(_.template(template,{counterindex:temp,Material:packmaterialname,Supplier:packsuppliername,Quantity:packQty,Price:packprice,packBasicPrice:packBasic})); var theForm = $(".final_product"); @@ -1668,6 +1866,18 @@ $('.CounteraddClick').click(function() addHidden(theForm,"packmaterialname"+temp,packmaterialname); + + + + addHidden(theForm,"pacbasic"+temp,packBasic); + var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#pacbasic"+i).val()); + } + + $('#packtotal').val(total); + $('#packumaterialcode').val(''); $('#packSupplier').val(''); $('#packqty').val(''); @@ -1713,6 +1923,12 @@ $('.CounterEditItem').click(function() var editpackprice = $('#Editpackprice').val(); //var editpacksuppliername = EditpackSupplier.options[EditpackSupplier.selectedIndex].text; + var basicprice = parseFloat(editpackQty)*parseFloat(editpackprice); + + var pacrow = $('#PkgRow').val(); + + + var tr= document.getElementById(cuserid); //var cellval = tr.cells; //alert(cuserid) @@ -1732,10 +1948,25 @@ $('.CounterEditItem').click(function() document.getElementById('packQuantiy'+cuserid).innerHTML = editpackQty; document.getElementById('packmaterialPrice'+cuserid).innerHTML = editpackprice; + document.getElementById('packmaterialbasic'+cuserid).innerHTML = basicprice; + $('#packmaterialcode'+cuserid).val(editpackmaterialcode); $('#packSupplierID'+cuserid).val(editpackSupplierID); $('#packQty'+cuserid).val(editpackQty); $('#packprice'+cuserid).val(editpackprice); + + $('#pacbasic'+cuserid).val(basicprice); + + var total = 0; + for(var i=1;i<=pacrow;i++) + { + total = parseFloat(total) + parseFloat($("#pacbasic"+i).val()); + //console.log(total) + } + $('#packtotal').val(total); + + + }); @@ -1750,12 +1981,14 @@ $('.CoaddClick').click(function() var copQty = $('#Coqty').val(); var copprice = $('#Coprice').val(); var copsuppliername = coproduct_id.options[coproduct_id.selectedIndex].text; + + var copbasic = parseFloat(copQty) * parseFloat(copprice); coproductindex = parseInt(coproductindex)+1; var temp = coproductindex var template = jQuery("#coproduct").html(); //alert(copsuppliername) - $('#coproductappend').append(_.template(template,{coproductindex:temp,Material:copsuppliername,Date:copDate,Quantity:copQty,Price:copprice})); + $('#coproductappend').append(_.template(template,{coproductindex:temp,Material:copsuppliername,Date:copDate,Quantity:copQty,Price:copprice,CopBasicPrice:copbasic})); var theForm = $(".final_product"); @@ -1764,7 +1997,18 @@ $('.CoaddClick').click(function() addHidden(theForm,"CopQty"+temp,copQty); addHidden(theForm,"Copprice"+temp,copprice); addHidden(theForm,"Coptype"+temp,"CoProduct"); - addHidden(theForm,"Copmaterialname"+temp,copsuppliername) + addHidden(theForm,"Copmaterialname"+temp,copsuppliername); + + + + addHidden(theForm,"copbasic"+temp,copbasic); + var total = 0; + for(var i=1;i<=temp;i++) + { + total = parseFloat(total) + parseFloat($("#copbasic"+i).val()); + } + + $('#coptotal').val(total); $('#coproduct_id').val(''); $('#CopDate').val(''); @@ -1806,6 +2050,9 @@ $('.CoEditItem').click(function() var editcopqty = $('#EditCoqty').val(); var editcopprice = $('#EditCoprice').val(); // var editcopproduct = Editcoproduct_id.options[Editcoproduct_id.selectedIndex].text; + + var copbasic = parseFloat(editcopqty)*parseFloat(editcopprice); + var coprow = $('#CopRow').val(); var tr= document.getElementById(cuserid); //var cellval = tr.cells; @@ -1824,83 +2071,178 @@ $('.CoEditItem').click(function() document.getElementById('CopQuantiy'+cuserid).innerHTML = editcopqty; document.getElementById('CopmaterialPrice'+cuserid).innerHTML = editcopprice; + + document.getElementById('Copmaterialbasic'+cuserid).innerHTML = copbasic; + $('#Copmaterialcode'+cuserid).val(editcoproductid); $('#CopDate'+cuserid).val(editcopdate); $('#CopQty'+cuserid).val(editcopqty); $('#Copprice'+cuserid).val(editcopprice); - + + $('#copbasic'+cuserid).val(copbasic); + + var total = 0; + for(var i=1;i<=coprow;i++) + { + total = parseFloat(total) + parseFloat($("#copbasic"+i).val()); + //console.log(total) + } + $('#coptotal').val(total); }); +var lowstock =; + + + +function lowqtycheck(type) +{ + //alert(type) + console.log(lowstock); + var materialcode = ''; + + if(type == 'rawmaterial') + { + materialcode = $('#rawmaterialcode').val(); + } + + if(type == 'consumables') + { + materialcode = $('#consumaterialcode').val(); + } + + if(type == 'packing') + { + materialcode = $('#packumaterialcode').val(); + } + + $.each(lowstock, function(id, obj) { + if(obj.MaterialCode == materialcode) + { + alert('Stock is running Low !! available Stock'+obj.Current_stock); + + } + }); + +} + + $('#rawmaterialcode').change(function() { var type = "rawmaterial"; - ResultantQty(type); + lowqtycheck(type); }); -$('#rawSupplier').change(function() -{ - var type = "rawmaterial"; - ResultantQty(type); - -}); $('#consumaterialcode').change(function() { var type = "consumables"; - ResultantQty(type); + lowqtycheck(type); }); -$('#consuSupplier').change(function() -{ - var type = "consumables"; - ResultantQty(type); - -}); - - $('#packumaterialcode').change(function() { var type = "packing"; - ResultantQty(type); + lowqtycheck(type); }); -$('#packSupplier').change(function() -{ - var type = "packing"; - ResultantQty(type); +// $('#rawSupplier').change(function() +// { +// var type = "rawmaterial"; +// ResultantQty(type); -}); +// }); +// $('#consuSupplier').change(function() +// { +// var type = "consumables"; +// ResultantQty(type); + +// }); + + +// $('#packSupplier').change(function() +// { +// var type = "packing"; +// ResultantQty(type); + +// }); + $('#Editrawmaterialcode').change(function() { var type = "rawmaterial"; - EditResultantQty(type); + Editlowqtycheck(type); }); -$('#EditrawSupplier').change(function() + + +$('#Editconsumaterialcode').change(function() { - - - var type = "rawmaterial"; - EditResultantQty(type); + var type = "consumables"; + Editlowqtycheck(type); }); +$('#Editpackumaterialcode').change(function() +{ + var type = "packing"; + Editlowqtycheck(type); + +}); + + + +function Editlowqtycheck(type) +{ + //alert(type) + //console.log(lowstock); + var materialcode = ''; + + if(type == 'rawmaterial') + { + materialcode = $('#Editrawmaterialcode').val(); + } + + if(type == 'consumables') + { + materialcode = $('#Editconsumaterialcode').val(); + } + + if(type == 'packing') + { + materialcode = $('#Editpackumaterialcode').val(); + } + + $.each(lowstock, function(id, obj) { + if(obj.MaterialCode == materialcode) + { + alert('Stock is running Low !! available Stock is '+obj.Current_stock); + + } + }); + +} + + + + + + + var today = new Date(); @@ -2839,75 +3181,28 @@ function Save() }); } -function rawqtycheck() + + + +function GetBasicvalue() { - // alert(rawresultqty); + var basic =0; + var qty= $('#Quantity').val(); + var val = $('#values').val(); - // var enterrawqty= $('#rawqty').val(); - // if(rawresultqty < enterrawqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+rawresultqty); - // } + if(qty != '' && val !='') + { + basic = parseFloat(qty)*parseFloat(val); + $('#basicvalue').val(basic); -} - -function editrawqtycheck() -{ - //alert(rawresultqty); - - // var editenterrawqty= $('#Editrawqty').val(); - // if(rawresultqty < editenterrawqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+rawresultqty); - // } - -} - - -function consuqtycheck() -{ - // alert(rawresultqty); - - // var enterconsuqty= $('#consuqty').val(); - // if(consuresultant < enterconsuqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+consuresultant); - // } - -} - - -function Editconsuqtycheck() -{ - // var editenterconsuqty= $('#Editconsuqty').val(); - // if(consuresultant < editenterconsuqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+consuresultant); - // } -} - - - -function packqtycheck() -{ - // alert(rawresultqty); - - // var enterpackqty= $('#packqty').val(); - // if(packresultant < enterpackqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+packresultant); - // } - -} - - -function Editpackqtycheck() -{ - // var entereditpackqty = $('#Editpackqty').val(); - // if(packresultant < entereditpackqty) - // { - // alert("You are Exceeding the Stock Qtantity!! Avalable stock is"+packresultant); - // } + } + + else + { + //alert('Please Enter Quantity and Value'); + $('#basicvalue').val(0); + } + }