diff --git a/application/config/constants.php b/application/config/constants.php index c5927afa..744f41ee 100755 --- a/application/config/constants.php +++ b/application/config/constants.php @@ -335,5 +335,6 @@ define('Capital_RMCIncludingCustomers_Charge1', define('Consumables', 'Consumables'); define('RawMaterial', 'Raw Material'); +define('Packingmaterial', 'Packing material'); /* End of file constants.php */ /* Location: ./application/config/constants.php */ diff --git a/application/config/routes.php b/application/config/routes.php index acfc2506..a4dfb98f 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -339,3 +339,7 @@ $route['poresetview']="purchaseorder/poresetview"; $route['FinalProduct'] = "batchcard/FinalProductCalculation"; $route['MaterailAdjustment'] = "batchcard/MaterailAdjustment"; + +$route['MaterailAdjustmentlist'] = "batchcard/MaterailAdjustmentlist"; + +$route['EditMaterialAdjustment'] = "batchcard/EditMaterialAdjustment"; diff --git a/application/controllers/batchcard.php b/application/controllers/batchcard.php index 42d88c17..fc429845 100755 --- a/application/controllers/batchcard.php +++ b/application/controllers/batchcard.php @@ -1263,7 +1263,9 @@ class batchcard extends BaseController $data['inv_final_product'] = $this->batchcard_model->getinvoice_products(); $data['consumable_material']= $this->batchcard_model->get_consumablematerials(); $data['Raw_material'] = $this->batchcard_model->get_rawmaterials(); + $data['Pack_material'] = $this->batchcard_model->get_packmaterials(); $data['supplier'] = $this->batchcard_model->getSupplierlist(); + //print_r($data['allhourdata']);die(); $this->global['pageTitle'] = 'Siddharth : Final Product'; $this->loadViews("FinalProduct", $this->global,$data,NULL); @@ -1279,6 +1281,16 @@ class batchcard extends BaseController $this->loadViews("materialadjustment", $this->global,$data,NULL); } + + + function MaterailAdjustmentlist() + { + $data['materailAdjustmentlist'] = $this->batchcard_model->getAllMaterialAdjustments(); + + $this->global['pageTitle'] = 'Siddharth : Material Adjustment'; + $this->loadViews("materialadjustmentlist", $this->global,$data,NULL); + } + function getQuantity() { $MaterialCode = $this->input->post('materialcode'); @@ -1316,6 +1328,11 @@ class batchcard extends BaseController $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); + //echo $dt; + + // echo $createddt; + // die(); + $adjustmentaarray = array('MaterialCode'=>$materialcode,'ActualQuantity'=>$ActualQty,'Quantity'=>$absaluteQty,'SupplierID'=>$supplier,'Reason'=>$reason,'Description'=>$Description,'CreatedOn'=>$createddt,'CreatedBy'=>$CreatedBy); $materialadjust = $this->batchcard_model->AddmaterialAdjustment($adjustmentaarray); @@ -1347,5 +1364,122 @@ class batchcard extends BaseController } + function Final_Product_Save() + { + $final_product = $this->input->post('DEPTFN'); + $final_qty = $this->input->post('Quantity'); + $product_date = $this->input->post('Date'); + //$pdt = $product_date->format('Y-m-d'); + $pdt = date("Y-m-d", strtotime($product_date)); + $product_value = $this->input->post('values'); + $createdby = $this->session->userdata('userId'); + + $final_master =array('MaterialCode'=>$final_product,'Quantity'=>$final_qty,'Price'=>$product_value,'CreatedBy'=>$createdby,'ProductDate'=>$pdt); + + $final_master_save =$this->batchcard_model->insert_final_product($final_master); + + // $final_product_id= $final_master_save[0]['PId']; + $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); + $createddt = $dt->format('Y-m-d H:i:s'); + + + + if(!empty($final_master_save)) + { + foreach($final_master_save as $pm) + { + $final_product_id = $pm->PId; + } + } + + $rawilne = $this->input->post('RawRow'); + $consuline = $this->input->post('ConsuRow'); + $packline = $this->input->post('PkgRow'); + $coproline = $this->input->post('CopRow'); + + //echo $coproline; + + for($i=1;$i<=$rawilne;$i++) + { + $rawmaterial = $this->input->post('rawmaterialcode'.$i); + $rawsupplier =$this->input->post('rawSupplierID'.$i); + $rawqty = $this->input->post('rawQty'.$i); + $rawvalue = $this->input->post('rawprice'.$i); + + $rawarray =array('FPId'=>$final_product_id,'MaterialCode'=>$rawmaterial,'SupplierID'=>$rawsupplier,'Quantity'=>$rawqty,'Price'=>$rawvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + //print_r($rawarray); + + $this->batchcard_model->save_finalraw($rawarray); + } + + + for($i=1;$i<=$consuline;$i++) + { + $conmaterial = $this->input->post('consumematerialcode'.$i); + $consupplier =$this->input->post('consumeSupplierID'.$i); + $conqty = $this->input->post('consumeQty'.$i); + $convalue = $this->input->post('consumeprice'.$i); + + $conarray =array('FPId'=>$final_product_id,'MaterialCode'=>$conmaterial,'SupplierID'=>$consupplier,'Quantity'=>$conqty,'Price'=>$convalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $this->batchcard_model->save_finalcon($conarray); + } + + + for($i=1;$i<=$packline;$i++) + { + $packmaterial = $this->input->post('packmaterialcode'.$i); + $packsupplier =$this->input->post('packSupplierID'.$i); + $packqty = $this->input->post('packQty'.$i); + $packvalue = $this->input->post('packprice'.$i); + + $packarray =array('FPId'=>$final_product_id,'MaterialCode'=>$packmaterial,'SupplierID'=>$packsupplier,'Quantity'=>$packqty,'Price'=>$packvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + $this->batchcard_model->save_finalpacking($packarray); + } + + + for($i=1;$i<=$coproline;$i++) + { + + $copmaterial = $this->input->post('Copmaterialcode'.$i); + $codate =$this->input->post('CopDate'.$i); + $copqty = $this->input->post('CopQty'.$i); + $copvalue = $this->input->post('Copprice'.$i); + + $coparray =array('FPId'=>$final_product_id,'MaterialCode'=>$copmaterial,'CoDate'=>$codate,'Quantity'=>$copqty,'Price'=>$copvalue,'CreatedBy'=>$createdby,'CreatedDate'=>$createddt); + + // print_r($coparray); + + $this->batchcard_model->save_finalcoproduct($coparray); + } + + echo "Details Saved Successfully"; + + + + } + + + function EditMaterialAdjustment() + { + + $AdjustmentId = $_GET['AdjustmentId']; + $data['materailAdjustmentlist'] = $this->batchcard_model->getEditMaterialAdjustments($AdjustmentId); + + $data['materiallist'] = $this->batchcard_model->getMaterial(); + + $data['getSupplierlist'] = $this->batchcard_model->getSupplierlist(); + + // print_r($data['materailAdjustmentlist']); + + + + $this->global['pageTitle'] = 'Siddharth : Material Adjustment'; + $this->loadViews("editmaterialadjustment", $this->global,$data,NULL); + } + + } ?> \ No newline at end of file diff --git a/application/models/batchcard_model.php b/application/models/batchcard_model.php index d4344f52..296cac0e 100755 --- a/application/models/batchcard_model.php +++ b/application/models/batchcard_model.php @@ -590,6 +590,16 @@ class batchcard_model extends CI_Model } + function get_packmaterials() + { + $this->db->select('MaterialCode,MaterialName,'); + $this->db->from('T_MaterialMaster'); + $this->db->where('T_MaterialMaster.Category',Packingmaterial); + $supp = $this->db->get(); + return $supp->result(); + } + + function getMaterial() { $this->db->select('MaterialCode,MaterialName,'); @@ -618,16 +628,28 @@ class batchcard_model extends CI_Model else { - // echo "after Finance"; + //echo "after Finance"; $startdate = $year.'-'.'04'.'-'.'01'; - //echo $startdate; + // echo $startdate; } + $nedt= $dt+1; - $subQuery='select (select sum(Quantity) as AddQty from T_Material_stock_history where Transaction_type = "Add" and MaterialCode=? -) as Addqty,(select sum(Quantity) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" and MaterialCode=? -) as ReduceQty from T_Material_stock_history where MaterialCode=? and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; - $query = $this->db->query($subQuery,array($MaterialCode,$MaterialCode,$MaterialCode,$startdate,$date,$Supplier)); + $newdate=$year.'-'.$month.'-'.$nedt; + + +// $subQuery='select (select sum(Quantity) as AddQty from T_Material_stock_history where Transaction_type = "Add" and MaterialCode=? +// ) as Addqty,(select sum(Quantity) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" and MaterialCode=? +// ) as ReduceQty from T_Material_stock_history where MaterialCode=? and CreatedOn >= ? and CreatedOn<=? and SupplierID=? group by Addqty'; + + + $subQuery='select ifnull((select ifnull(sum(Quantity),0) as AddQty from T_Material_stock_history +where Transaction_type = "Add" and MaterialCode=? and SupplierID=? ),0) as Addqty, +ifnull((select ifnull(sum(Quantity),0) as ReduceQty from T_Material_stock_history where Transaction_type = "Reduce" +and MaterialCode=? and SupplierID=? ),0) as ReduceQty from T_Material_stock_history where MaterialCode=? +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()); return $query->result_array(); @@ -663,6 +685,90 @@ class batchcard_model extends CI_Model return $insert_id; } + + + function insert_final_product($final_master) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_Master',$final_master); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + // print_r($this->db->last_query()); + //print_r($insert_id); + if($insert_id>0) + { + $subQuery = 'select max(FPId) as PId from T_FinalProduct_Master'; + $query = $this->db->query($subQuery); + + return $query->result(); + } + } + + + function save_finalraw($rawarray) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_RawMaterials',$rawarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + + } + + + function save_finalcon($conarray) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_ConsumableMaterials',$conarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + function save_finalpacking($packarray) + { + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_PackingMaterials',$packarray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + + function save_finalcoproduct($coparray) + { + + //print_r($coparray); + $this->db->trans_start(); + $this->db->insert('T_FinalProduct_CoProduct_Materials',$coparray); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + return true; + } + + + function getAllMaterialAdjustments() + { + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName'); + $this->db->from('T_Material_Adjustment'); + $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID'); + $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode'); + $res = $this->db->get(); + return $res->result(); + } + + + function getEditMaterialAdjustments($AdjustmentId) + { + + $this->db->select('T_Material_Adjustment.*,SupplierName,MaterialName'); + $this->db->from('T_Material_Adjustment'); + $this->db->join('T_SupplierDetailsN', 'T_Material_Adjustment.SupplierID = T_SupplierDetailsN.SupplierID'); + $this->db->join('T_MaterialMaster', 'T_MaterialMaster.MaterialCode = T_Material_Adjustment.MaterialCode'); + $this->db->where('T_Material_Adjustment.AdjustmentId',$AdjustmentId); + $res = $this->db->get(); + return $res->result(); + } } diff --git a/application/views/FinalProduct.php b/application/views/FinalProduct.php new file mode 100644 index 00000000..740cd1d6 --- /dev/null +++ b/application/views/FinalProduct.php @@ -0,0 +1,2242 @@ + + + + + + + + + +
+
+
+ +
+
+

Siddharth Industries -

+
+ +
+ + +
+ +
+ +
+ + 'form-label-left final_product ','name' => 'final_product','id' => 'final_product'); + + echo form_open($this->config->base_url().'/batchcard/Final+Product/',$attributes); + ?> + +
+
+ + + + 'Select Material'); + + if(!empty($inv_final_product)) + { + foreach ($inv_final_product as $SID): + + + $options2[$SID->product_id] = $SID->product_id.' '.' - '.' '.$SID->product_name; + + endforeach; + } + + echo form_dropdown('DEPTFN', $options2,set_value('DEPTFN',$SupId),'id="DEPTFN"' ,'required="true"' ,'class="form-control select2'); + + // $data = array('name' => 'Department','value' => set_value('Department'),'id'=>'Department', 'class' => 'form-control' ,'required' => 'true'); + // echo form_input($data); + + ?> + +
+ +
+ + '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'); + 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'); + echo form_input($data); + ?> +
+ +
+ + + + + + + +
+
+
+ + +
+
Raw Materials
+ +
+
+ + + Raw Materials + + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + +
S.NoMaterialSupplierQuantityPriceAction
+
+ + +
+
Consumables
+ +
+
+ Add Consumable Materials + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + +
S.NoMaterialSupplierQuantityPriceAction
+
+ + +
+
Packing Material
+ +
+
+ Add Packing Materials + + + + + + + +
+
+
+
+ +
+ + + + + + + + + + + + + + + + +
S.NoMaterialSupplierQuantityPriceAction
+
+ + + + + + + + + + + +
+
Co-Products
+ +
+
+ Add Co-Products + + + + + + + +
+
+
+
+ + + +
+ + + + + + + + + + + + + + + + + + +
S.NoMaterialDateQuantityPriceAction
+
+ + + + + + + + + + + + + + + + +
+   Save +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/application/views/editmaterialadjustment.php b/application/views/editmaterialadjustment.php new file mode 100644 index 00000000..c3c48540 --- /dev/null +++ b/application/views/editmaterialadjustment.php @@ -0,0 +1,443 @@ +SupplierID; + $materialcode = $mat->MaterialCode; + $date = $mat->CreatedOn; + // $edit_Qty_aspersystem= $mat->; + $edit_Actual_Qty= $mat->ActualQuantity; + $edit_Adjustable_qty= ''; + $edit_Description=''; + } +} + + + +?> + + + + + + + +
+ +
+ +

+
Siddharth Industries - Material Adjustment
+ +

+
+ +
+
+
+
+ 'form-label-left materialadjustment','name' => 'materialadjustment','id' => 'materialadjustment'); + + echo form_open($this->config->base_url().'batchcard/addmaterialadjustment',$attributes); + + + + ?> + +
+
+
+ + MaterialCode) + { + $options1[$material->MaterialCode] = $material->MaterialCode.' '.' - '.' '.$material->MaterialName; + } + } + + + foreach ($materiallist as $materiall) + { + if($materialcode != $material->MaterialCode) + { + + $options1[$materiall->MaterialCode] = $materiall->MaterialCode.' '.' - '.' '.$materiall->MaterialName; + + } + } + + + } + + echo form_dropdown('MaterialCode', $options1,set_value('MaterialCode',$materialcode),'id="MaterialCode"','class="form-control select2"' , 'required="true"'); + ?> +
+ +
+ +
+ + 'date','value' => set_value('date',$date),'id'=>'date', 'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;'); + echo form_input($data); + ?> +
+
+ + +
+ + 'Select Supplier'); + + if(!empty($Supplier)) + { + foreach ($Supplier as $PO): + $options[$PO->SupplierID] =$PO->SupplierID.' '.' - '.' '.$PO->SupplierName; + + + //$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName; + endforeach; + } + + + + + echo form_dropdown('supplier', $options,set_value('SupplierID'),'id="supplier"' ,'class="form-control select2"' , 'required="true"' ); + ?> +
+
+ + + +
+ +   Get Details + + +
+ +
+
+ + + + + + +
+ +
+
+ + +
+
+
+ 'Qty_aspersystem','value' => set_value('Qty_aspersystem',0),'id'=>'Qty_aspersystem', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true'); + echo form_input($data); + + ?> +
+
+
+ + + + +
+
+ + +
+
+
+ 'ActualQty','value' => set_value('ActualQty',0),'id'=>'ActualQty', 'class' => 'form-control num' ,'onchange'=>'calculateamount()'); + echo form_input($data); + + ?> +
+
+
+ + + +
+
+ + +
+
+
+ 'AdjustableQty','value' => set_value('AdjustableQty',0),'id'=>'AdjustableQty', 'class' => 'form-control num' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'', 'readonly'=>'true'); + echo form_input($data); + + ?> +
+
+
+ + +
+
+
+ + + + +
+
+ + +
+
+
+ 'Select'); + + // if(!empty($PONO)) + // { + // foreach ($PONO as $PO): + // $options[$PO->PONO] =$PO->PONO.' '.' - '.' '.$PO->POType; + + + // //$RL[$SID->ReqNo] = $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName; + // endforeach; + // } + + + + + echo form_dropdown('reason', $options,set_value('reason'),'id="reason"' ,'class="form-control select2"' , 'required="true"' ); + ?> +
+
+ + + +
+ + +
+
+ + +
+
+
+ 'Description','value' => set_value('Description'),'id'=>'Description', 'class' => 'form-control' ,'rows' => '5', 'cols' => '100','maxlength' => '250'); + echo Form_textarea($data); + ?> +
+
+
+ + + + +
+ + + +



+   Save +
+ + +
+ + + + +
+
+ + + diff --git a/application/views/includes/header.php b/application/views/includes/header.php index dc0e36ea..6729b5e5 100755 --- a/application/views/includes/header.php +++ b/application/views/includes/header.php @@ -400,11 +400,11 @@ display: none; - +
  • @@ -413,6 +413,12 @@ display: none;
  • +
  • + + Material Adjustment List + +
  • + + +
  • + + Final Product + +
  • +
  • Material Adjustment @@ -430,9 +443,18 @@ else{
  • +
  • + + Material Adjustment List + +
  • + + - - + + + + diff --git a/application/views/materialadjustment.php b/application/views/materialadjustment.php index f53a2bdf..d23957bd 100644 --- a/application/views/materialadjustment.php +++ b/application/views/materialadjustment.php @@ -281,6 +281,16 @@ $('.getdetails').click(function() { addqty = obj.Addqty; reduceqty = obj.ReduceQty; + + if(addqty == null) + { + adjustQty =0; + } + + if(reduceqty == null) + { + reduceqty=0; + } }); var resultantqty = parseFloat(addqty)- parseFloat(reduceqty); diff --git a/application/views/materialadjustmentlist.php b/application/views/materialadjustmentlist.php new file mode 100644 index 00000000..42d43f9e --- /dev/null +++ b/application/views/materialadjustmentlist.php @@ -0,0 +1,93 @@ + + +
    + + + +
    +
    +
    +
    +
    +

    Siddharth Industries - Material Adjustment List

    +
    + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    #Material Adjustment NoMaterial CodeSupplier NameAdjusted QtyAdjustmentAdjusted OnAction
    AdjustmentId ?>MaterialCode."-".$record->MaterialName; ?>SupplierID."-".$record->SupplierName; ?>Quantity ?>CreatedOn ?>    
    +
    + +
    + + +
    + +
    + +
    + +
    + + + +