FIX_igr changes 3rd commit
This commit is contained in:
parent
2519bd8fd6
commit
71017a7c79
@ -254,19 +254,14 @@ $routes->get('ViewIGR', 'Inwardgateregister::viewIGR'); // View IGR PAGE - Worki
|
|||||||
$routes->post('ViewIGRDetails', 'Inwardgateregister::viewIGRDetails');
|
$routes->post('ViewIGRDetails', 'Inwardgateregister::viewIGRDetails');
|
||||||
$routes->post('GetIGRLineItemDetails', 'Inwardgateregister::getIGRLineItemDetails');
|
$routes->post('GetIGRLineItemDetails', 'Inwardgateregister::getIGRLineItemDetails');
|
||||||
$routes->post('deleteBillFile', 'Inwardgateregister::deleteBillFile');
|
$routes->post('deleteBillFile', 'Inwardgateregister::deleteBillFile');
|
||||||
|
$routes->post('SaveIGR', 'Inwardgateregister::SaveIGR');// Save IGR PAGE - Working
|
||||||
|
$routes->post('UpdateIGR', 'Inwardgateregister::UpdateIGR');
|
||||||
|
$routes->post('updateIGRWeight', 'Inwardgateregister::updateIGRWeight');
|
||||||
$routes->post('inwardgateregister/addNewigr', 'Inwardgateregister::addNewigr');
|
$routes->post('UpdateIGRLineItem', 'Inwardgateregister::updateIGRLineItem');
|
||||||
$routes->post('inwardgateregister/ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
|
$routes->post('ViewIGRHistory', 'Inwardgateregister::ViewIGRHistory');
|
||||||
|
$routes->post('ViewIGRfile', 'Inwardgateregister::ViewIGRfile');
|
||||||
$routes->post('inwardgateregister/addloadfile', 'Inwardgateregister::addloadfile');
|
$routes->post('inwardgateregister/addloadfile', 'Inwardgateregister::addloadfile');
|
||||||
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
|
$routes->post('inwardgateregister/edituploadfile', 'Inwardgateregister::edituploadfile');
|
||||||
$routes->post('inwardgateregister/ViewIGRHistory', 'Inwardgateregister::ViewIGRHistory');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$routes->post('inwardgateregister/UpdateIGR', 'Inwardgateregister::UpdateIGR');
|
|
||||||
$routes->post('inwardgateregister/updateIGRLineItem', 'Inwardgateregister::updateIGRLineItem');
|
|
||||||
|
|
||||||
// Application OGR Page
|
// Application OGR Page
|
||||||
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'AddOgr', 'Inwardgateregister::addoutwardgateregister');
|
$routes->match(['GET', 'POST', 'PUT', 'DELETE'],'AddOgr', 'Inwardgateregister::addoutwardgateregister');
|
||||||
|
|||||||
@ -50,6 +50,7 @@ class Inwardgateregister extends BaseController
|
|||||||
|
|
||||||
$this->global['pageTitle'] = 'View Inward Gate Register';
|
$this->global['pageTitle'] = 'View Inward Gate Register';
|
||||||
$data['IGR'] = $this->inwardgateregister_model->ViewigrListing();
|
$data['IGR'] = $this->inwardgateregister_model->ViewigrListing();
|
||||||
|
$data['DEPCode'] = $this->session->get('DEPCode');
|
||||||
$this->loadViews("viewinwardgateregister", $this->global, $data, NULL);
|
$this->loadViews("viewinwardgateregister", $this->global, $data, NULL);
|
||||||
// $this->global['pageTitle'] = 'Inward Gate Register Details';
|
// $this->global['pageTitle'] = 'Inward Gate Register Details';
|
||||||
// $data['IGR'] = $this->inwardgateregister_model->igrListing();
|
// $data['IGR'] = $this->inwardgateregister_model->igrListing();
|
||||||
@ -304,7 +305,7 @@ class Inwardgateregister extends BaseController
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNewigr()
|
function SaveIGR()
|
||||||
{
|
{
|
||||||
#Step 1 IGR Details
|
#Step 1 IGR Details
|
||||||
$PONO = $this->request->getPost('PONO');
|
$PONO = $this->request->getPost('PONO');
|
||||||
@ -431,12 +432,20 @@ class Inwardgateregister extends BaseController
|
|||||||
$PendingQty = $this->request->getPost('txtPendingQty' . $i);
|
$PendingQty = $this->request->getPost('txtPendingQty' . $i);
|
||||||
$TotalPendingQty = $TotalPendingQty + $PendingQty;
|
$TotalPendingQty = $TotalPendingQty + $PendingQty;
|
||||||
$GrossWeight = $this->request->getPost('txtGrossWeight' . $i);
|
$GrossWeight = $this->request->getPost('txtGrossWeight' . $i);
|
||||||
$GrossWeightDate= $this->request->getPost('txtGrossWeightDate' . $i);
|
$grossWeightDate= $this->request->getPost('txtGrossWeightDate' . $i);
|
||||||
$TareWeight= $this->request->getPost('txtTareWeight' . $i);
|
$TareWeight= $this->request->getPost('txtTareWeight' . $i);
|
||||||
$TareWeightDate= $this->request->getPost('txtTareWeightDate' . $i);
|
$tareWeightDate= $this->request->getPost('txtTareWeightDate' . $i);
|
||||||
$NetWeight= $this->request->getPost('txtNetWeight' . $i);
|
$NetWeight= $this->request->getPost('txtNetWeight' . $i);
|
||||||
|
var_dump($grossWeightDate);
|
||||||
|
var_dump($tareWeightDate);
|
||||||
|
|
||||||
|
if (is_string($grossWeightDate) && is_string($tareWeightDate)) {
|
||||||
|
$GrossWeightDate = date('Y-m-d H:i:s', strtotime($grossWeightDate));
|
||||||
|
$TareWeightDate = date('Y-m-d H:i:s', strtotime($tareWeightDate));
|
||||||
|
} else {
|
||||||
|
$GrossWeightDate = null;
|
||||||
|
$TareWeightDate = null;
|
||||||
|
}
|
||||||
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') {
|
if (strlen($QuantityAsPerInvoice) > 0 && $QuantityAsPerInvoice != '0') {
|
||||||
$Remarks = $this->request->getPost('txtRemarks' . $i);
|
$Remarks = $this->request->getPost('txtRemarks' . $i);
|
||||||
$ItemStatus = '';
|
$ItemStatus = '';
|
||||||
@ -447,12 +456,8 @@ class Inwardgateregister extends BaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$CreatedBy = $this->session->get('userId');
|
$CreatedBy = $this->session->get('userId');
|
||||||
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
$igrDetails = array('IGRNO' => $IGRNO, 'MaterialCode' => $MaterialCode, 'QuantityAsPerInvoice' => $QuantityAsPerInvoice, 'Remarks' => $Remarks, 'IGRItemStatus' => $IGRItemStatus,'GrossWeight' => (float)$GrossWeight ,'GrossWeightDate'=> $GrossWeightDate,'TareWeight' => (float)$TareWeight ,'TareWeightDate' => $TareWeightDate ,'NetWeight' => (float)$NetWeight, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt);
|
||||||
$igrDetails['GrossWeight'] = $GrossWeight ;
|
log_message('error', 'SaveIGR igrDetails result : ' . json_encode($igrDetails));
|
||||||
$igrDetails['GrossWeightDate'] = $GrossWeightDate;
|
|
||||||
$igrDetails['TareWeight'] = $TareWeight;
|
|
||||||
$igrDetails['TareWeightDate'] = $TareWeightDate;
|
|
||||||
$igrDetails['NetWeight'] = $NetWeight;
|
|
||||||
|
|
||||||
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
$igrD = $this->inwardgateregister_model->addigrD($igrDetails);
|
||||||
$igrlineno = !empty($igrD) ? $igrD : '';
|
$igrlineno = !empty($igrD) ? $igrD : '';
|
||||||
@ -554,10 +559,10 @@ class Inwardgateregister extends BaseController
|
|||||||
$finalstatement = json_encode($finalstatement);
|
$finalstatement = json_encode($finalstatement);
|
||||||
|
|
||||||
|
|
||||||
echo "<script>
|
echo "<script>
|
||||||
alert('$finalstatement');
|
alert('$finalstatement');
|
||||||
window.location.href='viewIGRDetails';
|
window.location.href = 'ViewIGR';
|
||||||
</script>";
|
</script>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,11 +605,249 @@ function viewIGRDetails()
|
|||||||
$Mat_Rcvd_Dt = $this->request->getPost('mrc');
|
$Mat_Rcvd_Dt = $this->request->getPost('mrc');
|
||||||
$MaterialRcvdDt = get_date_time_format($Mat_Rcvd_Dt);
|
$MaterialRcvdDt = get_date_time_format($Mat_Rcvd_Dt);
|
||||||
|
|
||||||
|
$VehicleNo = $this->request->getPost('vehicle_no');
|
||||||
|
$DriverName = $this->request->getPost('driver');
|
||||||
|
$DriverMobileNumber = $this->request->getPost('driver_mobile');
|
||||||
|
|
||||||
|
$IGRStatus = (int)$this->request->getPost('status') == 1 ? IGR_CREATED : IGR_DRAFT;
|
||||||
|
|
||||||
|
$tableData = $this->request->getPost('tableData');
|
||||||
|
|
||||||
$updateby = $this->session->get('userId');
|
$updateby = $this->session->get('userId');
|
||||||
|
|
||||||
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'UpdateBY' => $updateby);
|
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'Status' => $IGRStatus,'UpdateBY' => $updateby);
|
||||||
|
|
||||||
$data = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
$data = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
|
||||||
|
if($VehicleNo){
|
||||||
|
$vecno = $this->inwardgateregister_model->get_igr_history('VehicleNo',$IGRNo);
|
||||||
|
|
||||||
|
if(!empty($vecno)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($vecno as $row) {
|
||||||
|
if ($row->field == 'VehicleNo') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'VehicleNo','new_data' => $VehicleNo,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{$igr_history = array('field' => 'VehicleNo','is_edit' => 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){
|
||||||
|
$drname = $this->inwardgateregister_model->get_igr_history('DriverName',$IGRNo);
|
||||||
|
|
||||||
|
if(!empty($drname)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($drname as $row) {
|
||||||
|
if ($row->field == 'DriverName') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'DriverName','new_data' => $DriverName,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'DriverName','is_edit' => 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){
|
||||||
|
$drmob = $this->inwardgateregister_model->get_igr_history('DriverMobileNumber',$IGRNo);
|
||||||
|
|
||||||
|
if(!empty($drmob)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($drmob as $row) {
|
||||||
|
if ($row->field == 'GrossWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'DriverMobileNumber','new_data' => $DriverMobileNumber,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'DriverMobileNumber','is_edit' => 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);
|
||||||
|
}}
|
||||||
|
foreach ($tableData as $row) {
|
||||||
|
$materialCode = $row['MaterialCode'];
|
||||||
|
$quantityAsPerInvoice = $row['QuantityAsPerInvoice'];
|
||||||
|
$remarks = $row['Remarks'];
|
||||||
|
$grossWeight = $row['GrossWeight'];
|
||||||
|
$grossWeightDate = $row['GrossWeightDate'];
|
||||||
|
$tareWeight = $row['TareWeight'];
|
||||||
|
$tareWeightDate = $row['TareWeightDate'];
|
||||||
|
$netWeight = $row['NetWeight'];
|
||||||
|
$igrItemNo = $row['IGRItemNo'];
|
||||||
|
$GrossWtDt = get_date_time_format($grossWeightDate);
|
||||||
|
$TareWtDt = get_date_time_format($tareWeightDate);
|
||||||
|
|
||||||
|
$igrline = array(
|
||||||
|
'IGRNO' => $IGRNo,
|
||||||
|
'MaterialCode' => $materialCode,
|
||||||
|
'QuantityAsPerInvoice' => $quantityAsPerInvoice,
|
||||||
|
'Remarks' => $remarks,
|
||||||
|
'GrossWeight' => $grossWeight,
|
||||||
|
'GrossWeightDate' => $grossWeightDate,
|
||||||
|
'TareWeight' => $tareWeight,
|
||||||
|
'TareWeightDate' => $tareWeightDate,
|
||||||
|
'NetWeight' => $netWeight,
|
||||||
|
'IGRItemNo' => $igrItemNo,
|
||||||
|
'UpdateBY' => $updateby
|
||||||
|
);
|
||||||
|
$lineitemupdated = $this->inwardgateregister_model->updateIGRLineItem($igrline, $igrItemNo);
|
||||||
|
log_message('error', "lineitem updated successfully: " . $$lineitemupdated);
|
||||||
|
if($quantityAsPerInvoice){
|
||||||
|
$qu = $this->inwardgateregister_model->get_igr_history('QuantityAsPerInvoice',$IGRNo,$igrItemNo);
|
||||||
|
|
||||||
|
if(!empty($qu)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($qu as $row) {
|
||||||
|
if ($row->field == 'QuantityAsPerInvoice') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'QuantityAsPerInvoice','new_data' => $quantityAsPerInvoice,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No' => $igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$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' => $igrItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}}
|
||||||
|
if($Remarks){
|
||||||
|
$remak = $this->inwardgateregister_model->get_igr_history('Remarks',$IGRNo,$igrItemNo);
|
||||||
|
|
||||||
|
if(!empty($remak)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($remak as $row) {
|
||||||
|
if ($row->field == 'Remarks') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'Remarks','new_data' => $Remarks,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No' => $igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{$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' => $igrItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}}
|
||||||
|
if($grossWeight){
|
||||||
|
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNo,$igrItemNo);
|
||||||
|
if(!empty($gross)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'GrossWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'GrossWeight','new_data' => $grossWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}else{
|
||||||
|
$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,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($tareWeight){
|
||||||
|
$tare = $this->inwardgateregister_model->get_igr_history('TareWeight',$IGRNo,$igrItemNo);
|
||||||
|
if(!empty($tare)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'TareWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'TareWeight','new_data' => $tareWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}else{
|
||||||
|
$igr_history = array('field' => 'TareWeight','is_edit' => 1,'new_data' => $tareWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($netWeight){
|
||||||
|
$net = $this->inwardgateregister_model->get_igr_history('NetWeight',$IGRNo,$igrItemNo);
|
||||||
|
if(!empty($net)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'NetWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'NetWeight','new_data' => $netWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'NetWeight','is_edit' => 1,'new_data' => $netWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($GrossWtDt){
|
||||||
|
$grossdate = $this->inwardgateregister_model->get_igr_history('GrossWeightDate',$IGRNo,$igrItemNo);
|
||||||
|
if(!empty($grossdate)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'GrossWeightDate') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'GrossWeightDate','new_data' => $GrossWtDt,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'GrossWeightDate','is_edit' => 1,'new_data' => $GrossWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($TareWtDt){
|
||||||
|
$taredate = $this->inwardgateregister_model->get_igr_history('TareWeightDate',$IGRNo,$igrItemNo);
|
||||||
|
|
||||||
|
if(!empty($taredate)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($taredate as $row) {
|
||||||
|
if ($row->field == 'TareWeightDate') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'TareWeightDate','new_data' => $TareWtDt,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'TareWeightDate','is_edit' => 1,'new_data' => $TareWtDt,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNo,'IGRItem_No'=>$igrItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if ($data > 0) {
|
if ($data > 0) {
|
||||||
echo "Updated Succefully!";
|
echo "Updated Succefully!";
|
||||||
@ -882,6 +1125,123 @@ function viewIGRDetails()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateIGRWeight(){
|
||||||
|
$GrossWeight = $this->request->getPost('GrossWeight');
|
||||||
|
$GrossWeightDate = $this->request->getPost('GrossWeightDate');
|
||||||
|
$TareWeight = $this->request->getPost('TareWeight');
|
||||||
|
$TareWeightDate = $this->request->getPost('TareWeightDate');
|
||||||
|
$NetWeight = $this->request->getPost('NetWeight');
|
||||||
|
$IGRNO = $this->request->getPost('IGR');
|
||||||
|
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
||||||
|
$updateby = $this->session->get('userId');
|
||||||
|
if($GrossWeight){
|
||||||
|
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNO, $IGRItemNo);
|
||||||
|
if(!empty($gross)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'GrossWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'GrossWeight','new_data' => $GrossWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}else{
|
||||||
|
$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,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($TareWeight){
|
||||||
|
$tare = $this->inwardgateregister_model->get_igr_history('TareWeight',$IGRNO, $IGRItemNo);
|
||||||
|
if(!empty($tare)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'TareWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'TareWeight','new_data' => $TareWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}else{
|
||||||
|
$igr_history = array('field' => 'TareWeight','is_edit' => 1,'new_data' => $TareWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($NetWeight){
|
||||||
|
$net = $this->inwardgateregister_model->get_igr_history('NetWeight',$IGRNO, $IGRItemNo);
|
||||||
|
if(!empty($net)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'NetWeight') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'NetWeight','new_data' => $NetWeight,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'NetWeight','is_edit' => 1,'new_data' => $NetWeight,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($GrossWeightDate){
|
||||||
|
$grossdate = $this->inwardgateregister_model->get_igr_history('GrossWeightDate',$IGRNO, $IGRItemNo);
|
||||||
|
if(!empty($grossdate)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($gross as $row) {
|
||||||
|
if ($row->field == 'GrossWeightDate') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'GrossWeightDate','new_data' => $GrossWeightDate,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'GrossWeightDate','is_edit' => 1,'new_data' => $GrossWeightDate,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($TareWeightDate){
|
||||||
|
$taredate = $this->inwardgateregister_model->get_igr_history('TareWeightDate',$IGRNO, $IGRItemNo);
|
||||||
|
|
||||||
|
if(!empty($taredate)){
|
||||||
|
$old_data = NULL;
|
||||||
|
foreach ($taredate as $row) {
|
||||||
|
if ($row->field == 'TareWeightDate') {
|
||||||
|
$old_data = $row->new_data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$igr_history = array('field' => 'TareWeightDate','new_data' => $TareWeightDate,'old_data' => $old_data,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
($old_data != NULL) ? $igr_history['is_edit'] = 1 : $igr_history['is_add'] = 1 ;
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
} else{
|
||||||
|
$igr_history = array('field' => 'TareWeightDate','is_edit' => 1,'new_data' => $TareWeightDate,'old_data' => NULL,'history_dated' => get_current_date_time(),'by' => $this->session->get('userId'),'IGR_No' => $IGRNO,'IGRItem_No'=>$IGRItemNo);
|
||||||
|
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
|
||||||
|
log_message('error', "History updated successfully. History id: " . $history_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$IGRItemNo = $this->request->getPost('IGRlineitem');
|
||||||
|
$igr_lineitem = array('GrossWeight' => $GrossWeight,'GrossWeightDate' => $GrossWeightDate,'TareWeightDate' => $TareWeightDate,'TareWeight' => $TareWeight,'NetWeight' => $NetWeight,'UpdateBY' => $updateby);
|
||||||
|
|
||||||
|
$update = $this->inwardgateregister_model->updateIGRLineItem($igr_lineitem, $IGRItemNo);
|
||||||
|
|
||||||
|
if ($update) {
|
||||||
|
echo "Details update successfully!";
|
||||||
|
}
|
||||||
|
}
|
||||||
function AddOgr()
|
function AddOgr()
|
||||||
{
|
{
|
||||||
//echo "string";
|
//echo "string";
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
<section class="content" style="margin: 15px;"><br/>
|
<section class="content" style="margin: 15px;"><br/>
|
||||||
<div style="border:2px solid #333;">
|
<div style="border:2px solid #333;">
|
||||||
|
|
||||||
<form action ="<?php echo base_url()?>inwardgateregister/addNewigr"
|
<form action ="<?php echo base_url()?>SaveIGR"
|
||||||
method="post" enctype="multipart/form-data">
|
method="post" enctype="multipart/form-data">
|
||||||
<div class="row"><br/><br/>
|
<div class="row"><br/><br/>
|
||||||
<div id="content" > </div>
|
<div id="content" > </div>
|
||||||
@ -294,7 +294,7 @@
|
|||||||
|
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||||
<center><h4>Weight Calculator</h4><div id="material"></div></center>
|
<center><h4>Weight Calculator</h4><div id="WeightTitle"></div></center>
|
||||||
<div class="pull-right hidden-xs">
|
<div class="pull-right hidden-xs">
|
||||||
<b><div id="clock"></div></b>
|
<b><div id="clock"></div></b>
|
||||||
</div>
|
</div>
|
||||||
@ -323,7 +323,7 @@
|
|||||||
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
|
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<?php
|
<?php
|
||||||
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);' ,'placeholder' => 'Enter your username','placeholder' => 'Tare Weight Value (B)');
|
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'validateTareWeight(this);' ,'placeholder' => 'Enter your username','placeholder' => 'Tare Weight Value (B)');
|
||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -771,7 +771,7 @@ function Save(status)
|
|||||||
// $.ajax({
|
// $.ajax({
|
||||||
// data:$('.IGR').serialize(),
|
// data:$('.IGR').serialize(),
|
||||||
// type:"POST",
|
// type:"POST",
|
||||||
// url:"<?php echo base_url() ?>inwardgateregister/addNewigr",
|
// url:"<?php echo base_url() ?>SaveIGR",
|
||||||
|
|
||||||
// success:function(data) {
|
// success:function(data) {
|
||||||
|
|
||||||
@ -795,7 +795,7 @@ function Save(status)
|
|||||||
//$('#tablevalues').val(jsondata);
|
//$('#tablevalues').val(jsondata);
|
||||||
$("#IGR").attr("method", "post");
|
$("#IGR").attr("method", "post");
|
||||||
$("#IGR").attr("enctype", "multipart/form-data");
|
$("#IGR").attr("enctype", "multipart/form-data");
|
||||||
$("#IGR").attr("action", "inwardgateregister/addNewigr");
|
$("#IGR").attr("action", "SaveIGR");
|
||||||
$('#IGR').submit();
|
$('#IGR').submit();
|
||||||
}//validate if closed
|
}//validate if closed
|
||||||
}//save function closed
|
}//save function closed
|
||||||
@ -1026,6 +1026,19 @@ function removeRows(inputs) {
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
|
function validateTareWeight(element) {
|
||||||
|
var grossWeight = parseFloat(document.getElementById('GrossWeight').value);
|
||||||
|
var tareWeight = parseFloat(document.getElementById('TareWeight').value);
|
||||||
|
|
||||||
|
if (tareWeight > grossWeight) {
|
||||||
|
alert("Tare Weight must be less than or equal to Gross Weight.");
|
||||||
|
document.getElementById('TareWeight').value = '';
|
||||||
|
document.getElementById('TareWeightDate').value = '';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WeightDiffer(element)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
function updateTime() {
|
function updateTime() {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const year = now.getFullYear();
|
const year = now.getFullYear();
|
||||||
@ -1039,24 +1052,23 @@ function removeRows(inputs) {
|
|||||||
document.getElementById('clock').textContent = dateString+" "+timeString;
|
document.getElementById('clock').textContent = dateString+" "+timeString;
|
||||||
document.getElementById('wizard_clock').textContent = dateString+" "+timeString;
|
document.getElementById('wizard_clock').textContent = dateString+" "+timeString;
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(updateTime, 1000); // Update every second
|
setInterval(updateTime, 1000); // Update every second
|
||||||
updateTime(); // Initial call to display time immediately
|
updateTime(); // Initial call to display time immediately
|
||||||
function WeightDiffer(element)
|
function WeightDiffer(element)
|
||||||
{
|
{
|
||||||
// console.log(element);
|
// console.log(element);
|
||||||
var v1 = $("#GrossWeight").val();
|
var v1 = $("#GrossWeight").val();
|
||||||
var v2 = $("#TareWeight").val();
|
var v2 = $("#TareWeight").val();
|
||||||
var v3 = v1-v2;
|
var v3 = v1-v2;
|
||||||
$("#NetWeight").val(v3);
|
$("#NetWeight").val(v3);
|
||||||
if (element.id === 'GrossWeight') {
|
if (element.id === 'GrossWeight') {
|
||||||
$("#GrossWeightDate").val($("#clock").text());
|
$("#GrossWeightDate").val($("#clock").text());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (element.id === 'TareWeight') {
|
if (element.id === 'TareWeight') {
|
||||||
$("#TareWeightDate").val($("#clock").text());
|
$("#TareWeightDate").val($("#clock").text());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
@ -1064,7 +1076,7 @@ function removeRows(inputs) {
|
|||||||
var inx = $(e.relatedTarget).data('index');
|
var inx = $(e.relatedTarget).data('index');
|
||||||
var material = $(e.relatedTarget).data('material');
|
var material = $(e.relatedTarget).data('material');
|
||||||
|
|
||||||
document.getElementById('material').textContent = " ( "+material+" )";
|
document.getElementById('WeightTitle').textContent = " ( "+material+" )";
|
||||||
|
|
||||||
|
|
||||||
// Clear the modal inputs
|
// Clear the modal inputs
|
||||||
|
|||||||
@ -54,19 +54,20 @@
|
|||||||
var mindt = year-70;
|
var mindt = year-70;
|
||||||
var maxdt = year-15;
|
var maxdt = year-15;
|
||||||
|
|
||||||
$("#Invoice_Date , #MaterialRcvdDate ").datepicker({
|
$("#Invoice_Date , #MaterialRcvdDate").datepicker({
|
||||||
minDate : new Date(year-SIAStartYear,1,1),
|
minDate : new Date(year-SIAStartYear,1,1),
|
||||||
maxDate :'now',
|
maxDate :'now',
|
||||||
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,
|
dateFormat: 'dd-mm-yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<section class="content"><br/>
|
<section class="content"><br/>
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
<center><b><h3 class="box-title">View Inward Gate Register</h3></b></center>
|
<center><b><h3 class="box-title">View Inward Gate Register <?php echo $DEPCode; ?></h3></b></center>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
@ -118,7 +119,7 @@
|
|||||||
<i class="fa fa-history" style="text-align: center;"></i>
|
<i class="fa fa-history" style="text-align: center;"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a>
|
<a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -173,14 +174,14 @@
|
|||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label>Invoice Date </label>
|
<label>Invoice Date <span class="requiredsymbol" style="color:red; font-size: 15px;">*</span></label>
|
||||||
<?php
|
<?php
|
||||||
$data = array('name' => 'InvoiceDate','value' => set_value('InvoiceDate'),'id'=>'Invoice_Date', 'class' => 'form-control', 'required=>"true"');
|
$data = array('name' => 'InvoiceDate','value' => set_value('InvoiceDate'),'id'=>'Invoice_Date', 'class' => 'form-control', 'required=>"true"');
|
||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label>Material Received Date </label>
|
<label>Material Received Date <span class="requiredsymbol" style="color:red; font-size: 15px;">*</span> </label>
|
||||||
<?php
|
<?php
|
||||||
$data = array('name' => 'MaterialRcvdDate','value' => set_value('MaterialRcvdDate'),'id'=>'MaterialRcvdDate', 'class' => 'form-control');
|
$data = array('name' => 'MaterialRcvdDate','value' => set_value('MaterialRcvdDate'),'id'=>'MaterialRcvdDate', 'class' => 'form-control');
|
||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
@ -293,7 +294,7 @@
|
|||||||
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
|
<label for="TareWeight" class="col-md-2 col-form-label">Tare Weight</label>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<?php
|
<?php
|
||||||
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50', 'onchange' => 'WeightDiffer(this);' ,'placeholder' => 'Enter your username','placeholder' => 'Tare Weight Value (B)');
|
$data = array('name' => 'TareWeight', 'value' => set_value('TareWeight'), 'id' => 'TareWeight', 'class' => 'form-control', 'onkeypress' => 'return isNumberKey(event);', 'maxlength' => '50','onchange' => 'validateTareWeight(this);' ,'placeholder' => 'Tare Weight Value (B)');
|
||||||
echo form_input($data);
|
echo form_input($data);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@ -367,8 +368,8 @@
|
|||||||
<input type="button" class="btn btn-primary" id="addmorebutton" value=" ADD FILES..">
|
<input type="button" class="btn btn-primary" id="addmorebutton" value=" ADD FILES..">
|
||||||
</div>
|
</div>
|
||||||
<div id="newdiv"></div>
|
<div id="newdiv"></div>
|
||||||
<input type="text" name="hidecounter" id="hidecounter" value="0" />
|
<input type="hidden" name="hidecounter" id="hidecounter" value="0" />
|
||||||
<input type="text" name="counts" id="counts" value="0" />
|
<input type="hidden" name="hidegrandcounter" id="hidegrandcounter" value="0" />
|
||||||
<input type="hidden" name="hiddenIGRNO" id="hiddenIGRNO" />
|
<input type="hidden" name="hiddenIGRNO" id="hiddenIGRNO" />
|
||||||
<input type="hidden" name="hiddenPONO" id="hiddenPONO" />
|
<input type="hidden" name="hiddenPONO" id="hiddenPONO" />
|
||||||
</div>
|
</div>
|
||||||
@ -444,7 +445,7 @@
|
|||||||
var igr = $(e.relatedTarget).data('userid');
|
var igr = $(e.relatedTarget).data('userid');
|
||||||
var igrstatus = $(e.relatedTarget).data('igrstatus');
|
var igrstatus = $(e.relatedTarget).data('igrstatus');
|
||||||
|
|
||||||
alert(igrstatus);
|
// alert(igrstatus);
|
||||||
var buttonContainer = $(".buttonContainer");
|
var buttonContainer = $(".buttonContainer");
|
||||||
var modal = $(this); // Reference to the modal itself
|
var modal = $(this); // Reference to the modal itself
|
||||||
var invoiceDateInput = modal.find('#Invoice_Date');
|
var invoiceDateInput = modal.find('#Invoice_Date');
|
||||||
@ -452,23 +453,34 @@
|
|||||||
var VehicleNoInput = modal.find('#Vehicle_No');
|
var VehicleNoInput = modal.find('#Vehicle_No');
|
||||||
var DriverInput = modal.find('#Driver_Name');
|
var DriverInput = modal.find('#Driver_Name');
|
||||||
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
var DriverMobileNumberInput = modal.find('#DriverMobileNumber');
|
||||||
|
var depCode = "<?php echo $DEPCode; ?>";
|
||||||
|
|
||||||
|
// depCode != "DEP27"
|
||||||
|
if(depCode == "DEP27"){
|
||||||
|
if (igrstatus == "ST074") {
|
||||||
if (igrstatus == "ST074") {
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
||||||
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
// $(".a_tag_for_mrir).css("display", "inline-block");
|
||||||
VehicleNoInput.prop('readonly', false);
|
VehicleNoInput.prop('readonly', false);
|
||||||
DriverInput.prop('readonly', false);
|
DriverInput.prop('readonly', false);
|
||||||
DriverMobileNumberInput.prop('readonly', false);
|
DriverMobileNumberInput.prop('readonly', false);
|
||||||
|
MaterialRcvdDateInput.prop('readonly', false);
|
||||||
} else {
|
invoiceDateInput.prop('readonly', false);
|
||||||
// Hide buttons in the container
|
} else {
|
||||||
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "none");
|
||||||
VehicleNoInput.prop('readonly', true);
|
// $(".a_tag_for_mrir).css("display", "inline-block");
|
||||||
DriverInput.prop('readonly', true);
|
VehicleNoInput.prop('readonly', true);
|
||||||
DriverMobileNumberInput.prop('readonly', true);
|
DriverInput.prop('readonly', true);
|
||||||
|
DriverMobileNumberInput.prop('readonly', true);
|
||||||
|
MaterialRcvdDateInput.prop('readonly', true);
|
||||||
|
invoiceDateInput.prop('readonly', true);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if (igrstatus == "ST074") {
|
||||||
|
buttonContainer.find("#draftIGR, #generateIGR").css("display", "inline-block");
|
||||||
|
// $(".a_tag_for_mrir).css("display", "inline-block");
|
||||||
|
} else {
|
||||||
|
buttonContainer.find("#draftIGR").css("display", "none");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#tbleIGRAppend").empty();
|
$("#tbleIGRAppend").empty();
|
||||||
@ -483,6 +495,7 @@
|
|||||||
var trIGRHTML = '';
|
var trIGRHTML = '';
|
||||||
$.each(JSON.parse(data), function(i, item) {
|
$.each(JSON.parse(data), function(i, item) {
|
||||||
if (igr == item.IGRNO) {
|
if (igr == item.IGRNO) {
|
||||||
|
console.log(item);
|
||||||
$('#IgrshowTitle').text(" ( "+item.IGRNO+" ) ");
|
$('#IgrshowTitle').text(" ( "+item.IGRNO+" ) ");
|
||||||
$("#IGRNO1").val(item.IGRNO);
|
$("#IGRNO1").val(item.IGRNO);
|
||||||
$("#IGRItemNo").val(item.IGRItemNo);
|
$("#IGRItemNo").val(item.IGRItemNo);
|
||||||
@ -501,16 +514,17 @@
|
|||||||
$("#Supplier").val(item.SupplierName);
|
$("#Supplier").val(item.SupplierName);
|
||||||
$("#Add1").val(item.Address);
|
$("#Add1").val(item.Address);
|
||||||
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
|
||||||
alert(item.DeliveryChellanDate);
|
// alert(item.DeliveryChellanDate);
|
||||||
var dcd = new Date(item.DeliveryChellanDate);
|
var dcd = new Date(item.DeliveryChellanDate);
|
||||||
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
//alert(dcd.getDate()+ '.' + (dcd.getMonth() + 1)+ '.' + dcd.getFullYear());
|
||||||
var dcd2 = (dcd.getDate() + '/' + (dcd.getMonth() + 1) + '/' + dcd.getFullYear());
|
// var dcd2 = (dcd.getDate() + '/' + (dcd.getMonth() + 1) + '/' + dcd.getFullYear());
|
||||||
|
var dcd2 = (String(dcd.getDate()).padStart(2, '0') + '-' + (String(dcd.getMonth() + 1).padStart(2, '0')) + '-' + dcd.getFullYear());
|
||||||
$("#Invoice_Date").val(dcd2);
|
$("#Invoice_Date").val(dcd2);
|
||||||
if (item.MaterialRcvdDate === null) {
|
if (item.MaterialRcvdDate === null) {
|
||||||
var Mat_rcv_date = ' ';
|
var Mat_rcv_date = ' ';
|
||||||
} else {
|
} else {
|
||||||
var MR_dt = new Date(item.MaterialRcvdDate);
|
var MR_dt = new Date(item.MaterialRcvdDate);
|
||||||
var Mat_rcv_date = (MR_dt.getDate() + '/' + (MR_dt.getMonth() + 1) + '/' + MR_dt.getFullYear());
|
var Mat_rcv_date = (String(MR_dt.getDate()).padStart(2, '0') + '-' + (String(MR_dt.getMonth() + 1).padStart(2, '0')) + '-' + MR_dt.getFullYear());
|
||||||
}
|
}
|
||||||
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
$("#MaterialRcvdDate").val(Mat_rcv_date);
|
||||||
if (item.GrossWeightDate === null) {
|
if (item.GrossWeightDate === null) {
|
||||||
@ -524,7 +538,7 @@
|
|||||||
|
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
if (igrstatus === "ST074") {
|
if (igrstatus === "ST074") {
|
||||||
alert("here");
|
// alert("here");
|
||||||
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
// document.getElementById('pendingQuantityHeader').style.display = 'table-cell';
|
||||||
$("#pendingQuantityHeader").css("display", "table-cell");
|
$("#pendingQuantityHeader").css("display", "table-cell");
|
||||||
|
|
||||||
@ -551,7 +565,8 @@
|
|||||||
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
||||||
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
||||||
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
||||||
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '">'; // Example with no initial value
|
'<input type="hidden" id="txtRemarks' + i + '" name="txtRemarks' + i + '"value="' + item.Remarks + '">' + // Example with no initial value
|
||||||
|
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
//alert(item.PendingQty);
|
//alert(item.PendingQty);
|
||||||
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
if ((item.Quantity - item.QuantityAsPerInvoice) == 0.00) {
|
||||||
@ -570,11 +585,17 @@
|
|||||||
'<td align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
|
'<td align="right" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
|
||||||
'<td>' + item.Remarks + '</td>' +
|
'<td>' + item.Remarks + '</td>' +
|
||||||
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
'<td><a target="_blank" data-toggle="modal" data-target="#WeightCalculator" title="Weight Calculator" data-index="'+i+'" data-material="'+item.MaterialName+'" data-igrstatus = "'+igrstatus+'"><i class="fa fa-solid fa-truck" style="text-align: center;"></i></a> </td>' +
|
||||||
|
'<input type="hidden" id="IGRNO' + i + '" name="IGRNO' + i + '" value="' + item.IGRNO + '">' +
|
||||||
|
'<input type="hidden" id="IGRItemNo' + i + '" name="IGRItemNo' + i + '" value="' + item.IGRItemNo + '">' +
|
||||||
|
'<input type="hidden" id="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
|
||||||
|
'<input type="hidden" id="txtQuantityAsPerInvoice' + i + '" name="txtQuantityAsPerInvoice' + i + '" value="' + item.QuantityAsPerInvoice + '">' +
|
||||||
|
'<input type="hidden" id="txtOrderedQuantity' + i + '" name="txtOrderedQuantity' + i + '" value="' + item.Quantity + '">' +
|
||||||
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
'<input type="hidden" id="txtGrossWeight' + i + '" name="txtGrossWeight' + i + '" value="' + item.GrossWeight + '">' +
|
||||||
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
|
'<input type="hidden" id="txtGrossWeightDate' + i + '" name="txtGrossWeightDate' + i + '" value="' + item.GrossWeightDate + '">' +
|
||||||
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
'<input type="hidden" id="txtTareWeight' + i + '" name="txtTareWeight' + i + '" value="' + item.TareWeight + '">' +
|
||||||
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
'<input type="hidden" id="txtTareWeightDate' + i + '" name="txtTareWeightDate' + i + '" value="' + item.TareWeightDate + '">' +
|
||||||
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
'<input type="hidden" id="txtNetWeight' + i + '" name="txtNetWeight' + i + '"value="' + item.NetWeight + '">' +
|
||||||
|
'<input type="hidden" id="txtIGRLineItem' + i + '" name="txtIGRLineItem' + i + '"value="' + item.IGRItemNo + '">' +
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -600,39 +621,79 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url:"<?php echo base_url() ?>inwardgateregister/UpdateIGR",
|
url:"<?php echo base_url() ?>UpdateIGR",
|
||||||
success:function(data) {
|
success:function(data) {
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
alert(data);
|
alert(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('#update').click(function(){
|
$('#draftIGR').click(function(){
|
||||||
$('#content').loader('show');
|
$('#content').loader('show');
|
||||||
var igrno = $("#IGRNO1").val();
|
var igrno = $("#IGRNO1").val();
|
||||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
var materialrcv_date = $("#MaterialRcvdDate").val();
|
||||||
var inv_date = $("#Invoice_Date").val();
|
var inv_date = $("#Invoice_Date").val();
|
||||||
|
var vehicle_no = $('#Vehicle_No').val();
|
||||||
|
var driver = $('#Driver_Name').val();
|
||||||
|
var driver_mobile = $('#DriverMobileNumber').val();
|
||||||
|
var status = 0;
|
||||||
|
var tableData = [];
|
||||||
|
$('#tbleIGRAppend tr').each(function() {
|
||||||
|
var row = $(this);
|
||||||
|
var rowData = {
|
||||||
|
MaterialCode: row.find('#MaterialCode' + row.index()).val(),
|
||||||
|
Quantity: row.find('#txtOrderedQuantity' + row.index()).val(),
|
||||||
|
QuantityAsPerInvoice: row.find('#txtQuantityAsPerInvoice' + row.index()).val(),
|
||||||
|
Remarks: row.find('#txtGrossWeight' + row.index()).val(),
|
||||||
|
GrossWeight: row.find('#txtGrossWeight' + row.index()).val(),
|
||||||
|
GrossWeightDate: row.find('#txtGrossWeightDate' + row.index()).val(),
|
||||||
|
TareWeight: row.find('#txtTareWeight' + row.index()).val(),
|
||||||
|
TareWeightDate: row.find('#txtTareWeightDate' + row.index()).val(),
|
||||||
|
NetWeight: row.find('#txtNetWeight' + row.index()).val(),
|
||||||
|
IGRItemNo: row.find('#txtIGRLineItem' + row.index()).val()
|
||||||
|
};
|
||||||
|
tableData.push(rowData);
|
||||||
|
});
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date,vehicle_no:vehicle_no,driver:driver,driver_mobile:driver_mobile,status:status,tableData: tableData},
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url:"<?php echo base_url() ?>inwardgateregister/UpdateIGR",
|
url:"<?php echo base_url() ?>UpdateIGR",
|
||||||
success:function(data) {
|
success:function(data) {
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
alert(data);
|
alert(data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('#update').click(function(){
|
$('#generateIGR').click(function(){
|
||||||
$('#content').loader('show');
|
$('#content').loader('show');
|
||||||
var igrno = $("#IGRNO1").val();
|
var igrno = $("#IGRNO1").val();
|
||||||
var materialrcv_date = $("#MaterialRcvdDate").val();
|
var materialrcv_date = $("#MaterialRcvdDate").val();
|
||||||
var inv_date = $("#Invoice_Date").val();
|
var inv_date = $("#Invoice_Date").val();
|
||||||
|
var vehicle_no = $('#Vehicle_No').val();
|
||||||
|
var driver = $('#Driver_Name').val();
|
||||||
|
var driver_mobile = $('#DriverMobileNumber').val();
|
||||||
|
var status = 1;
|
||||||
|
var tableData = [];
|
||||||
|
$('#tbleIGRAppend tr').each(function() {
|
||||||
|
var row = $(this);
|
||||||
|
var rowData = {
|
||||||
|
MaterialCode: row.find('#MaterialCode' + row.index()).val(),
|
||||||
|
Quantity: row.find('#txtOrderedQuantity' + row.index()).val(),
|
||||||
|
QuantityAsPerInvoice: row.find('#txtQuantityAsPerInvoice' + row.index()).val(),
|
||||||
|
GrossWeight: row.find('#txtGrossWeight' + row.index()).val(),
|
||||||
|
GrossWeightDate: row.find('#txtGrossWeightDate' + row.index()).val(),
|
||||||
|
TareWeight: row.find('#txtTareWeight' + row.index()).val(),
|
||||||
|
TareWeightDate: row.find('#txtTareWeightDate' + row.index()).val(),
|
||||||
|
NetWeight: row.find('#txtNetWeight' + row.index()).val(),
|
||||||
|
IGRItemNo: row.find('#txtIGRLineItem' + row.index()).val()
|
||||||
|
};
|
||||||
|
tableData.push(rowData);
|
||||||
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date},
|
data:{igr:igrno,mrc:materialrcv_date,invdate:inv_date,vehicle_no:vehicle_no,driver:driver,driver_mobile:driver_mobile,status:status,tableData: tableData},
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url:"<?php echo base_url() ?>inwardgateregister/UpdateIGR",
|
url:"<?php echo base_url() ?>UpdateIGR",
|
||||||
success:function(data) {
|
success:function(data) {
|
||||||
$('#content').loader('hide');
|
$('#content').loader('hide');
|
||||||
alert(data);
|
alert(data);
|
||||||
@ -651,7 +712,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
data: { igr: igr },
|
data: { igr: igr },
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url() ?>inwardgateregister/ViewIGRHistory",
|
url: "<?php echo base_url() ?>ViewIGRHistory",
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
var output = '';
|
var output = '';
|
||||||
if (data && data.length > 0) {
|
if (data && data.length > 0) {
|
||||||
@ -771,10 +832,10 @@ $("#Fileshow").on("shown.bs.modal", function(e) {
|
|||||||
id1: po
|
id1: po
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "<?php echo base_url() ?>inwardgateregister/ViewIGRfile",
|
url: "<?php echo base_url() ?>ViewIGRfile",
|
||||||
success: function(file) {
|
success: function(file) {
|
||||||
|
|
||||||
$("#counts").val(JSON.parse(file).length);
|
$("#hidegrandcounter").val(JSON.parse(file).length);
|
||||||
|
|
||||||
var trFileHTML = '';
|
var trFileHTML = '';
|
||||||
var FilePath = '';
|
var FilePath = '';
|
||||||
@ -878,6 +939,145 @@ function deleteBill(Billno,i){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
function validateTareWeight(element) {
|
||||||
|
var grossWeight = parseFloat(document.getElementById('GrossWeight').value);
|
||||||
|
var tareWeight = parseFloat(document.getElementById('TareWeight').value);
|
||||||
|
|
||||||
|
if (tareWeight > grossWeight) {
|
||||||
|
alert("Tare Weight must be less than or equal to Gross Weight.");
|
||||||
|
document.getElementById('TareWeight').value = '';
|
||||||
|
document.getElementById('TareWeightDate').value = '';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WeightDiffer(element)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
function updateTime() {
|
||||||
|
const now = new Date();
|
||||||
|
const year = now.getFullYear();
|
||||||
|
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
||||||
|
const todaydate = now.getDate().toString().padStart(2, '0');
|
||||||
|
const hours = now.getHours().toString().padStart(2, '0');
|
||||||
|
const minutes = now.getMinutes().toString().padStart(2, '0');
|
||||||
|
const seconds = now.getSeconds().toString().padStart(2, '0');
|
||||||
|
const dateString = todaydate+'-'+month+'-'+year;
|
||||||
|
const timeString = hours+":"+minutes+":"+seconds;
|
||||||
|
document.getElementById('clock').textContent = dateString+" "+timeString;
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(updateTime, 1000); // Update every second
|
||||||
|
updateTime(); // Initial call to display time immediately
|
||||||
|
function WeightDiffer(element)
|
||||||
|
{
|
||||||
|
// console.log(element);
|
||||||
|
var v1 = $("#GrossWeight").val();
|
||||||
|
var v2 = $("#TareWeight").val();
|
||||||
|
var v3 = v1-v2;
|
||||||
|
$("#NetWeight").val(v3);
|
||||||
|
if (element.id === 'GrossWeight') {
|
||||||
|
$("#GrossWeightDate").val($("#clock").text());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (element.id === 'TareWeight') {
|
||||||
|
$("#TareWeightDate").val($("#clock").text());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$("#WeightCalculator").on("shown.bs.modal", function(e) {
|
||||||
|
var inx = $(e.relatedTarget).data('index');
|
||||||
|
var material = $(e.relatedTarget).data('material');
|
||||||
|
|
||||||
|
document.getElementById('WeightTitle').textContent = " ( "+material+" )";
|
||||||
|
|
||||||
|
|
||||||
|
// Clear the modal inputs
|
||||||
|
$("#GrossWeight").val('');
|
||||||
|
$("#GrossWeightDate").val('');
|
||||||
|
$("#TareWeight").val('');
|
||||||
|
$("#TareWeightDate").val('');
|
||||||
|
$("#NetWeight").val('');
|
||||||
|
|
||||||
|
// Retrieve values from hidden inputs
|
||||||
|
var v1 = $("#txtGrossWeight" + inx).val();
|
||||||
|
var v2 = $("#txtGrossWeightDate" + inx).val();
|
||||||
|
var v3 = $("#txtTareWeight" + inx).val();
|
||||||
|
var v4 = $("#txtTareWeightDate" + inx).val();
|
||||||
|
var v5 = $("#txtNetWeight" + inx).val();
|
||||||
|
|
||||||
|
|
||||||
|
// Debugging alerts
|
||||||
|
// console.log("v1:", v1);
|
||||||
|
// console.log("v2:", v2);
|
||||||
|
// console.log("v3:", v3);
|
||||||
|
// console.log("v4:", v4);
|
||||||
|
// console.log("v5:", v5);
|
||||||
|
console.log("Selected values for index:", typeof inx,inx);
|
||||||
|
|
||||||
|
// Set modal inputs with the retrieved values
|
||||||
|
$("#GrossWeight").val(v1);
|
||||||
|
$("#GrossWeightDate").val(v2);
|
||||||
|
$("#TareWeight").val(v3);
|
||||||
|
$("#TareWeightDate").val(v4);
|
||||||
|
$("#NetWeight").val(v5);
|
||||||
|
$("#CurrentInx").val(inx);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function modalSave() {
|
||||||
|
var v1 = $("#GrossWeight").val();
|
||||||
|
var v2 = $("#GrossWeightDate").val();
|
||||||
|
var v3 = $("#TareWeight").val();
|
||||||
|
var v4 = $("#TareWeightDate").val();
|
||||||
|
var v5 = $("#NetWeight").val();
|
||||||
|
var v6 = $("#CurrentInx").val();
|
||||||
|
var IGRNO1 = $("#IGRNO1").val();
|
||||||
|
|
||||||
|
// Debugging alerts
|
||||||
|
// console.log("v1:", v1);
|
||||||
|
// console.log("v2:", v2);
|
||||||
|
// console.log("v3:", v3);
|
||||||
|
// console.log("v4:", v4);
|
||||||
|
// console.log("v5:", v5);
|
||||||
|
if (v6 !== undefined && v6 !== '') {
|
||||||
|
console.log("Saving values for index:", v6);
|
||||||
|
|
||||||
|
// Set the values back to the hidden inputs
|
||||||
|
$("#txtGrossWeight" + v6).val(v1);
|
||||||
|
$("#txtGrossWeightDate" + v6).val(v2);
|
||||||
|
$("#txtTareWeight" + v6).val(v3);
|
||||||
|
$("#txtTareWeightDate" + v6).val(v4);
|
||||||
|
$("#txtNetWeight" + v6).val(v5);
|
||||||
|
var txtIGRLineItem = $("#txtIGRLineItem" + v6).val();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
data:{GrossWeight:v1,GrossWeightDate:v2,TareWeight:v3,TareWeightDate:v4,NetWeight:v5,IGR:IGRNO1,IGRlineitem:txtIGRLineItem},
|
||||||
|
//dataType:"json",
|
||||||
|
type:"POST",
|
||||||
|
url: "<?php echo base_url() ?>updateIGRWeight",
|
||||||
|
success:function(data) {
|
||||||
|
if(data)
|
||||||
|
{
|
||||||
|
alert(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// Clear modal inputs
|
||||||
|
$("#GrossWeight").val('');
|
||||||
|
$("#GrossWeightDate").val('');
|
||||||
|
$("#TareWeight").val('');
|
||||||
|
$("#TareWeightDate").val('');
|
||||||
|
$("#NetWeight").val('');
|
||||||
|
|
||||||
|
// Close the modal
|
||||||
|
$("#WeightCalculator").modal('hide');
|
||||||
|
} else {
|
||||||
|
console.log("Saving values for index: "+v6+" undefined");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function formatDateTime(dateString) {
|
function formatDateTime(dateString) {
|
||||||
@ -957,7 +1157,7 @@ function deleteBill(Billno,i){
|
|||||||
|
|
||||||
$("#addmorebutton").click(function() {
|
$("#addmorebutton").click(function() {
|
||||||
$('#newdiv').empty();
|
$('#newdiv').empty();
|
||||||
var file_count = $("#counts").val();
|
var file_count = $("#hidegrandcounter").val();
|
||||||
counter++;
|
counter++;
|
||||||
var bil_count = +counter + +file_count;
|
var bil_count = +counter + +file_count;
|
||||||
if (bil_count >= 6) {
|
if (bil_count >= 6) {
|
||||||
@ -1032,8 +1232,8 @@ function deleteBill(Billno,i){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
function addToTable(counter,billNo, fileName) {
|
function addToTable(counter,billNo, fileName) {
|
||||||
var file_count = $("#counts").val();
|
var hidecounter = $("#hidecounter").val();
|
||||||
alert(file_count);
|
var file_count = $("#hidegrandcounter").val();
|
||||||
|
|
||||||
var newRow = '<tr id="row' + counter + '">' +
|
var newRow = '<tr id="row' + counter + '">' +
|
||||||
'<td>' + counter + '</td>' +
|
'<td>' + counter + '</td>' +
|
||||||
@ -1053,8 +1253,6 @@ function deleteBill(Billno,i){
|
|||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<!-- Latest jQuery -->
|
|
||||||
<script src="https://code.jquery.com/jquery-3.6.4.min.js"></script>
|
|
||||||
<!-- Latest DataTables JS -->
|
<!-- Latest DataTables JS -->
|
||||||
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
|
||||||
<!-- Latest DataTables Buttons JS -->
|
<!-- Latest DataTables Buttons JS -->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user