diff --git a/app/Config/Constants.php b/app/Config/Constants.php index a378fe33..203b25fd 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -141,9 +141,9 @@ define('REQ_READYFORDELIVERY','ST049'); define('REQ_DELIVERED','ST050'); /* IGR Status */ +define('IGR_DRAFT','ST074'); define('IGR_CREATED','ST027'); define('IGR_CLOSED','ST028'); -define('IGR_DRAFT','ST074'); define('IGR_CANCELLED','ST029'); define('POLINEITEM_IGRPARTIAL_CREATED','ST042'); diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 01516e4f..b791c429 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -261,6 +261,7 @@ $routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituplo $routes->post('inwardgateregister/addloadfile', 'Inwardgateregister::addloadfile'); $routes->post('inwardgateregister/UpdateIGR', 'Inwardgateregister::UpdateIGR'); $routes->post('inwardgateregister/updateIGRLineItem', 'Inwardgateregister::updateIGRLineItem'); +$routes->post('inwardgateregister/ViewIGRHistory', 'Inwardgateregister::ViewIGRHistory'); // Application OGR Page $routes->match(['get', 'post', 'put', 'delete'],'AddOgr', 'Inwardgateregister::addoutwardgateregister'); diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index d7ec8a1f..30f52632 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -67,7 +67,6 @@ class Inwardgateregister extends BaseController return !($item->status === 'ST027' && $item->IsOpenOrder === null); }); - $this->loadViews("inwardgateregister", $this->global, $data, NULL); } @@ -314,11 +313,81 @@ class Inwardgateregister extends BaseController $prefile = array(); $fileupdated_count = 0; $fileupdated_name = []; + $GrossWeight = $this->request->getPost('GrossWeight'); + $TareWeight = $this->request->getPost('TareWeight'); + $NetWeight = $this->request->getPost('NetWeight'); + $GrossWeightDate = (string)$this->request->getPost('GrossWeightDate'); + $GrossWtDt = get_date_time_format($GrossWeightDate); + $TareWeightDate = (string)$this->request->getPost('TareWeightDate'); + $TareWtDt = get_date_time_format($TareWeightDate); - $igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus); + // $igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus); + $igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus,'GrossWeight'=>$GrossWeight,'TareWeight'=>$TareWeight,'NetWeight'=>$NetWeight,'GrossWeightDate'=>$GrossWtDt,'TareWeightDate'=>$TareWtDt); + + //Saving IGR details Here $IGRNO = $this->inwardgateregister_model->addigrM($igr); if($IGRNO){ + #Step 1.1 Fetch On History + if($GrossWeight){ + $igr_history = array('field' => 'GrossWeight','is_add' => 1,'new_data' => $GrossWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + + } + if($TareWeight){ + $igr_history = array('field' => 'TareWeight','is_add' => 1,'new_data' => $TareWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + + } + if($NetWeight){ + $igr_history = array('field' => 'NetWeight','is_add' => 1,'new_data' => $NetWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + + } + if($GrossWtDt){ + $igr_history = array('field' => 'GrossWeightDate','is_add' => 1,'new_data' => $GrossWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + + } + if($TareWtDt){ + $igr_history = array('field' => 'TareWeightDate','is_add' => 1,'new_data' => $TareWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + } + // if($DeliveryChellanOrInvoiceNo){ + // $igr_history = array('field' => 'DeliveryChellanOrInvoiceNo','is_add' => 1,'new_data' => $DeliveryChellanOrInvoiceNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + // $history_id = $this->inwardgateregister_model->igr_history($igr_history); + // log_message('error', "History updated successfully. History id: " . $history_id); + // } + // if($DeliveryChellanDate){ + // $igr_history = array('field' => 'DeliveryChellanDate','is_add' => 1,'new_data' => $DeliveryChellanDate,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + // $history_id = $this->inwardgateregister_model->igr_history($igr_history); + // log_message('error', "History updated successfully. History id: " . $history_id); + // } + // if($MaterialRcvdDt){ + // $igr_history = array('field' => 'MaterialRcvdDate','is_add' => 1,'new_data' => $MaterialRcvdDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + // $history_id = $this->inwardgateregister_model->igr_history($igr_history); + // log_message('error', "History updated successfully. History id: " . $history_id); + // } + if($VehicleNo){ + $igr_history = array('field' => 'VehicleNo','is_add' => 1,'new_data' => $VehicleNo,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + } + if($DriverName){ + $igr_history = array('field' => 'DriverName','is_add' => 1,'new_data' => $DriverName,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + } + if($DriverMobileNumber){ + $igr_history = array('field' => 'DriverMobileNumber','is_add' => 1,'new_data' => $DriverMobileNumber,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + } #Step 2 File Details Gathering if($constant){ for ($i = 1; $i <= $constant; $i++) { @@ -411,6 +480,7 @@ class Inwardgateregister extends BaseController $igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt); $igrD = $this->inwardgateregister_model->addigrD($igrDetails); $igrlineno = !empty($igrD) ? $igrD : ''; + $itemvalue = ''; $SupplierId = ''; $polineitemvalue = $this->inwardgateregister_model->getitemvalue($PONO, $MaterialCode); @@ -420,6 +490,16 @@ class Inwardgateregister extends BaseController } $historydetails = array('MaterialCode' => $MaterialCode, 'Transaction_type' => "Add", 'Ref_Type' => "IGR", 'Ref_No' => $igrlineno, 'Quantity' => $QuantityAsPerInvoice, 'CreatedBy' => $CreatedBy, 'CreatedOn' => $createddt, 'SupplierID' => $SupplierId, 'ItemValue' => $itemvalue); $this->inwardgateregister_model->addmaterialhistory($historydetails); + if($QuantityAsPerInvoice){ + $igr_history = array('field' => 'QuantityAsPerInvoice','is_add' => 1,'new_data' => $QuantityAsPerInvoice,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$igrlineno); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + } + if($Remarks){ + $igr_history = array('field' => 'Remarks','is_add' => 1,'new_data' => $Remarks,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$igrlineno); + $history_id = $this->inwardgateregister_model->igr_history($igr_history); + log_message('error', "History updated successfully. History id: " . $history_id); + } $get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode); $av_qty = 0; if (!empty($get_pre_qty)) { @@ -668,7 +748,8 @@ echo " \ No newline at end of file + + \ No newline at end of file diff --git a/app/Views/viewIGRDetails.php b/app/Views/viewIGRDetails.php index 54dcdd0f..4f22d792 100644 --- a/app/Views/viewIGRDetails.php +++ b/app/Views/viewIGRDetails.php @@ -1,219 +1,257 @@ + + margin-right: 10px; + /* Add some spacing between buttons */ + } + + .modal-footer { + border-top-color: #fff ! important; + } +
- -

-
-
-

View Inward Gate Register

-
-
-
-
- -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IGR NoPO NoSupplier NameInvoice NoDate of InvoiceVechicle NoCreated DateCourier NoFile
IGRNO ?>PONO ?>SupplierName ?>DeliveryChellanOrInvoiceNo ?>DeliveryChellanDate); - echo $date->format('d-m-Y'); ?>VehicleNo ?>CreatedDate ?>CourierNo ?>FilePath)){ ?> - - - file)){ ?> - - - - - - IGRStatus !== "ST074") { ?> - - -
+

+
+
+
+

View Inward Gate Register

+
-
-
-
- - - - - - + + + + + + + + +
-
- - - - - - - - - + -if (igrstatus == "ST074") { - // Show buttons in the container - buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block"); -} else { - // Hide buttons in the container - buttonContainer.find("#draftIGR, #generateIGR").css("display", "none"); -} + + + \ No newline at end of file diff --git a/app/Views/viewinwardgateregister.php b/app/Views/viewinwardgateregister.php index 52364eaf..3f57b684 100644 --- a/app/Views/viewinwardgateregister.php +++ b/app/Views/viewinwardgateregister.php @@ -1,111 +1,127 @@ - + minDate: new Date(year - SIAStartYear, 1, 1), + maxDate: 'now', + dateFormat: 'dd-mm-yy', + changeMonth: true, + changeYear: true, + }); + }); +
- -

-
-
-
-

View Inward Gate Register

-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IGR NoPO NoSupplier NameInvoice NoDate of InvoiceVechicle NoCourier NoAction
IGRNO ?>PONO ?>SupplierName ?>DeliveryChellanOrInvoiceNo ?>DeliveryChellanDate); - echo $date->format('d-m-Y'); ?>VehicleNo ?>CreatedDate ?> - -
-
-
-
+ +

+
+
+
+
+

View Inward Gate Register

+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
IGR NoPO NoSupplier NameInvoice NoDate of InvoiceVechicle NoCourier NoAction
IGRNO ?>PONO ?>SupplierName ?>DeliveryChellanOrInvoiceNo ?>DeliveryChellanDate); + echo $date->format('d-m-Y'); ?>VehicleNo ?>CreatedDate ?> + + +
+
+
+
- -
-
- - - + echo form_input($data); + ?> +
+
+ + 'InvoiceDate', 'value' => set_value('InvoiceDate'), 'id' => 'Invoice_Date', 'class' => 'form-control', 'required=>"true"'); + echo form_input($data); + ?> +
+
+ + 'MaterialRcvdDate', 'value' => set_value('MaterialRcvdDate'), 'id' => 'MaterialRcvdDate', 'class' => 'form-control'); + echo form_input($data); + ?> +
+ +
+
+ + 'VehicleNo', 'value' => set_value('VehicleNo'), 'id' => 'Vehicle_No', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true'); + echo form_input($data); + ?> +
+
+ + 'DriverName', 'value' => set_value('DriverName'), 'id' => 'Driver_Name', 'class' => 'form-control', 'required=>"true"', 'readonly' => 'true'); + + echo form_input($data); + ?> +
+
+ + 'DriverMobileNumber', 'value' => set_value('DriverMobileNumber'), 'id' => 'DriverMobileNumber', 'class' => 'form-control', 'readonly' => 'true'); + echo form_input($data); + ?> +
+
+ + + +
+ + + + + + + + + + + + + + +
SNoItem CodeItem DescriptionUOMOrdred QuantityReceived QuantityRemarks
+
+
+ +
+ 'GrossWeight', 'value' => set_value('GrossWeight'), 'id' => 'GrossWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);'); + echo form_input($data); + ?> +
+
+ 'GrossWeightDate', 'value' => set_value('GrossWeightDate'), 'id' => 'GrossWeightDate', 'class' => 'form-control', 'readonly' => true); + echo form_input($data); + ?> +
+
+ +
+ +
+ 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);'); + echo form_input($data); + ?> +
+
+ 'TareWeightDate', 'value' => set_value('TareWeightDate'), 'id' => 'TareWeightDate', 'class' => 'form-control', 'readonly' => true); + echo form_input($data); + ?> +
+
+ +
+ +
+ 'NetWeight', 'value' => set_value('NetWeight'), 'id' => 'NetWeight', 'class' => 'form-control', 'maxlength' => '50', 'readonly' => true); + echo form_input($data); + ?> +
+
+
+ + + + + + + + + + + + + + \ No newline at end of file