Merge branch 'new_theme' of bitbucket.org:venbainformationtechnology/ria into new_theme

This commit is contained in:
Gowtham M 2025-02-03 14:16:58 +05:30
commit d57c7823e2
9 changed files with 512 additions and 689 deletions

View File

@ -409,6 +409,7 @@ class Inwardgateregister extends BaseController
$DriverMobileNumber = $this->request->getPost('DriverMobileNumber');
$CreatedBy = $this->session->get('userId');
$RowCount = $this->request->getPost('txtRowCount');
$MasterRemarks = $this->request->getPost('MasterRemarks');
$createddt = get_current_date_time();
//$IGRStatus = IGR_CREATED;//old
$PreIGRStatus = (int)$this->request->getPost('hideIGRStatus') == 1 ? IGR_CREATED : IGR_DRAFT;
@ -441,13 +442,11 @@ class Inwardgateregister extends BaseController
}
}
#Step 3 Master Details Gathering to Save In DB
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'TransporterId'=>$TransporterId,'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus);
$igr = array('PONO' => $PONO, 'VehicleNo' => $VehicleNo, 'TransporterId'=>$TransporterId,'DeliveryChellanOrInvoiceNo' => $DeliveryChellanOrInvoiceNo, 'DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $IGRStatus, 'CreatedBy' => $CreatedBy, 'CreatedDate' => $createddt, 'PaymentStatus' => $paymentstatus, 'Remark'=>$MasterRemarks);
$igr['MasterFile'] = $requestMasterFileName;
#Step 4 Calling DB to Save IGR Master
$IGRNO = $this->inwardgateregister_model->addigrM($igr);
// echo "master - no problem";
// $IGRNO = "IGRNO02767";
// print_r($this->request->getPost());die;
if($IGRNO){
$files = $this->request->getFiles();
$fileNames = $this->request->getPost('file_name'); // Get user-entered file names
@ -477,19 +476,16 @@ class Inwardgateregister extends BaseController
#Step 5 Save Master Detail On History Table
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);
$hist = array('key' => 'VehicleNo', 'value' => $VehicleNo, 'igr_no' => $IGRNO, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
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);
$hist = array('key' => 'DriverName', 'value' => $DriverName, 'igr_no' => $IGRNO, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
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);
$hist = array('key' => 'DriverMobileNumber', 'value' => $DriverMobileNumber, 'igr_no' => $IGRNO, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
#Step 6 Updating OGR Details
@ -583,43 +579,32 @@ 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($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,'IGRItem_No'=>$igrlineno);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
$hist = array('key' => 'GrossWeight', 'value' => $GrossWeight, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
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,'IGRItem_No'=>$igrlineno);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
$hist = array('key' => 'TareWeight', 'value' => $TareWeight, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
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,'IGRItem_No'=>$igrlineno);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
$hist = array('key' => 'NetWeight', 'value' => $NetWeight, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
if($GrossWeightDate){
$igr_history = array('field' => 'GrossWeightDate','is_add' => 1,'new_data' => $GrossWeightDate,'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);
$hist = array('key' => 'GrossWeightDate', 'value' => $GrossWeightDate, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
if($TareWeightDate){
$igr_history = array('field' => 'TareWeightDate','is_add' => 1,'new_data' => $TareWeightDate,'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);
$hist = array('key' => 'TareWeightDate', 'value' => $TareWeightDate, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
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);
$hist = array('key' => 'QuantityAsPerInvoice', 'value' => $QuantityAsPerInvoice, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
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);
$hist = array('key' => 'Remarks', 'value' => $Remarks, 'igr_no' => $IGRNO, 'igr_item_no' => $igrlineno);
$this->saveIGRHistory($hist);
}
$get_pre_qty = $this->inwardgateregister_model->get_CurrentQty($MaterialCode);
$av_qty = 0; //$av_qty means Avaliable Quantity
@ -720,10 +705,42 @@ function viewIGRDetails()
$IGRNO = $this->request->getPost('id');
$data['details'] = $this->inwardgateregister_model->viewigr($IGRNO);
$data['files'] = $this->inwardgateregister_model->viewIGRFile($IGRNO);
$TaxInPercentage = 0;
for ($i = 0; $i < count($data['details']); $i++) {
$details = $data['details'][$i];
// echo $IGRNO;
// print_r($data);die;
if ($details->POType == 'IMPORT') {
$TaxInPercentage = isset($details->import_igst) ? $details->import_igst : 0;
}
if ($details->POType == 'CAPITAL' && $details->CapitalRange == 0) {
$TaxInPercentage = isset($details->import_igst) ? $details->import_igst : 0;
}
if ($details->POType == 'CAPITAL' && $details->CapitalRange == 1) {
$TaxInPercentage =
(isset($details->service_cgst) ? $details->service_cgst : 0) +
(isset($details->service_sgst) ? $details->service_sgst : 0) +
(isset($details->service_igst) ? $details->service_igst : 0);
}
if ($details->POType == 'REVENUE') {
$TaxInPercentage =
(isset($details->revenue_cgst) ? $details->revenue_cgst : 0) +
(isset($details->revenue_sgst) ? $details->revenue_sgst : 0) +
(isset($details->revenue_igst) ? $details->revenue_igst : 0);
}
if ($details->POType == 'SERVICE') {
$TaxInPercentage =
(isset($details->service_cgst) ? $details->service_cgst : 0) +
(isset($details->service_sgst) ? $details->service_sgst : 0) +
(isset($details->service_igst) ? $details->service_igst : 0);
}
$data['details'][$i]->TaxInPercentage = $TaxInPercentage;
}
$data['files'] = $this->inwardgateregister_model->viewIGRFile($IGRNO);
echo json_encode($data);
}
@ -768,7 +785,7 @@ function viewIGRDetails()
$TransporterId = $this->request->getPost('Transporter_Id');
$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');
@ -780,7 +797,8 @@ function viewIGRDetails()
$path = ROOTPATH.'public/uploads/Igrfiles/';
if(!is_dir($path)) { mkdir($path, 0777, true); }
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'TransporterId'=>$TransporterId,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo);
$MasterRemarks = $this->request->getPost('MasterRemarks');
$igrarr = array('DeliveryChellanDate' => $DeliveryChellanDate, 'MaterialRcvdDate' => $MaterialRcvdDt,'VehicleNo'=>$VehicleNo,'TransporterId'=>$TransporterId,'DriverMobileNumber'=>$DriverMobileNumber,'DriverName'=>$DriverName, 'IGRStatus' => $IGRStatus,'UpdateBY' => $updateby,'DeliveryChellanOrInvoiceNo'=>$DeliveryChellanOrInvoiceNo,'Remark'=>$MasterRemarks);
$MasterFile = $this->request->getfile('MasterFile');
@ -836,61 +854,17 @@ function viewIGRDetails()
log_message('error', "Master updated successfully: " . $updateigrmaster);
if(!empty($tableData )){
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);
}}
$hist = array('key' => 'VehicleNo', 'value' => $VehicleNo, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
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);
}}
$hist = array('key' => 'DriverName', 'value' => $DriverName, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
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);
}}
$hist = array('key' => 'DriverMobileNumber', 'value' => $DriverMobileNumber, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
foreach ($tableData as $row) {
$quantityAsPerInvoice = $row['QuantityAsPerInvoice'];
$remarks = $row['Remarks'];
@ -933,169 +907,77 @@ function viewIGRDetails()
log_message('error', "lineitem updated successfully: " . $updateigrlineitem);
log_message('error', 'UpdateIGR updateigrlineitem: ' . json_encode($igrline));
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 ($quantityAsPerInvoice) {
$hist = array('key' => 'QuantityAsPerInvoice', 'value' => $quantityAsPerInvoice, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
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);
}}
$hist = array('key' => 'Remarks', 'value' => $remarks, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
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);
}
$hist = array('key' => 'GrossWeight', 'value' => $grossWeight, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
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);
}
$hist = array('key' => 'TareWeight', 'value' => $tareWeight, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
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);
}
$hist = array('key' => 'NetWeight', 'value' => $netWeight, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
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);
}
$hist = array('key' => 'GrossWeightDate', 'value' => $GrossWtDt, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
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);
}
$hist = array('key' => 'TareWeightDate', 'value' => $TareWtDt, 'igr_no' => $IGRNo, 'igr_item_no' => $igrItemNo);
$this->saveIGRHistory($hist);
}
}
}
$result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'));
if ($getigrstatus == 'ST027' && ($updateigrmaster > 0 || $updateigrlineitem > 0)) {
if ($updateigrmaster > 0 || $updateigrlineitem > 0) {
if ($getigrstatus == 'ST027') {
$result_for_email = $this->inwardgateregister_model->getDetailsforEmail($this->session->get('userId'));
$result_for_history = $this->inwardgateregister_model->getHistoryDetailsforEmail($IGRNo);
// print_r($result_for_email);
$notification = new Notification();
$history_content = NULL;
$history = $result_for_history;
$field_labels = [
"Remarks" => "Remarks",
"QuantityAsPerInvoice" => "Received Qty",
"GrossWeight" => "Gross Weight",
"TareWeight" => "Tare Weight",
"NetWeight" => "Net Weight",
"GrossWeightDate" => "Gross Weight Date",
"TareWeightDate" => "Tare Weight Date",
"VehicleNo" => "Vehicle Number",
"DriverName" => "Driver Name",
"DriverMobileNumber" => "Driver Mobile Number"
];
$history_content = "<br>The following values have been edited:<br>";
for ($j = 0; $j < count($history); $j++) {
$field_name = $history[$j]->field;
$readable_field = isset($field_labels[$field_name]) ? $field_labels[$field_name] : $field_name;
$history_content .= "<br>" . $readable_field . ": " . $history[$j]->old_data . " was updated to " . $history[$j]->new_data . ".";
}
for ($i = 0; $i < count($result_for_email['emails']); $i++) {
$email_response = $notification->sendEmail([
'recipient_email' => $result_for_email['emails'][$i]->email,
'subject' => $result_for_email['company'].' - IGR Notification',
'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name')),
'description' => 'IGR Number : '.$IGRNo.' is Edited By '.($result_for_email['full_name'] ?? $this->session->get('name'))." On ".date('d-m-Y H:i A', strtotime(get_current_date_time() . ' +30 seconds')). $history_content,
'company' => $result_for_email['company'],
'from_mail'=> $result_for_email['from_mail']
]);
@ -1112,11 +994,9 @@ function viewIGRDetails()
$this->logger->error("Email ID = " . $result_for_email['emails'][$i]->email . " " . $mail_log);
}
}
}
// echo "***".$history_content;die;
}
if ($updateigrmaster > 0) {
$finalstatement = "Successfully Updated IGR Number: $IGRNo \n";
} else if($updateigrlineitem >0){
@ -1160,102 +1040,26 @@ function viewIGRDetails()
if (is_array($lineitemdata)) {
if($GrossWeight){
$gross = $this->inwardgateregister_model->get_igr_history('GrossWeight',$IGRNo);
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);
($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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
$hist = array('key' => 'GrossWeight', 'value' => $GrossWeight, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
if($TareWeight){
$tare = $this->inwardgateregister_model->get_igr_history('TareWeight',$IGRNo);
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);
($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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
$hist = array('key' => 'TareWeight', 'value' => $TareWeight, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
if($NetWeight){
$net = $this->inwardgateregister_model->get_igr_history('NetWeight',$IGRNo);
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);
($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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
$hist = array('key' => 'NetWeight', 'value' => $NetWeight, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
if($GrossWtDt){
$grossdate = $this->inwardgateregister_model->get_igr_history('GrossWeightDate',$IGRNo);
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);
($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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
if($GrossWtDt){
$hist = array('key' => 'GrossWeightDate', 'value' => $GrossWtDt, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
if($TareWtDt){
$taredate = $this->inwardgateregister_model->get_igr_history('TareWeightDate',$IGRNo);
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);
($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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
if($TareWtDt){
$hist = array('key' => 'TareWeightDate', 'value' => $TareWtDt, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
// if($DeliveryChellanOrInvoiceNo){
// $igr_history = array('field' => 'DeliveryChellanOrInvoiceNo','is_edit' => 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);
@ -1271,62 +1075,19 @@ function viewIGRDetails()
// $history_id = $this->inwardgateregister_model->igr_history($igr_history);
// log_message('error', "History updated successfully. History id: " . $history_id);
// }
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);
}}
if($VehicleNo){
$hist = array('key' => 'VehicleNo', 'value' => $VehicleNo, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
if($DriverName){
$hist = array('key' => 'DriverName', 'value' => $DriverName, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
if($DriverMobileNumber){
$hist = array('key' => 'DriverMobileNumber', 'value' => $DriverMobileNumber, 'igr_no' => $IGRNo, 'igr_item_no' => NULL);
$this->saveIGRHistory($hist);
}
$igrarr = array('VehicleNo' => $VehicleNo, 'DriverName' => $DriverName, 'DriverMobileNumber' => $DriverMobileNumber,'IGRStatus' => $Status, 'UpdateBY' => $updateby,'GrossWeight'=>$GrossWeight,'TareWeight'=>$TareWeight,'NetWeight'=>$NetWeight,'GrossWeightDate'=>$GrossWtDt,'TareWeightDate'=>$TareWtDt);
$masterdata = $this->inwardgateregister_model->updateigr($igrarr, $IGRNo);
@ -1350,43 +1111,14 @@ function viewIGRDetails()
);
// print_r($igrline);
$lineitemdata = $this->inwardgateregister_model->updateIGRLineItem($igrline, $IGRItemNo);
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($QuantityAsPerInvoice){
$hist = array('key' => 'QuantityAsPerInvoice', 'value' => $QuantityAsPerInvoice, 'igr_no' => $IGRNo, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
if($Remarks){
$hist = array('key' => 'Remarks', 'value' => $Remarks, 'igr_no' => $IGRNo, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
$i++;
if ($lineitemdata > 0) {
$dummy++;
@ -1425,101 +1157,24 @@ function updateIGRWeight(){
if(!is_dir($path)) { mkdir($path, 0777, true); }
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);
}
$hist = array('key' => 'GrossWeight', 'value' => $GrossWeight, 'igr_no' => $IGRNO, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
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($GrossWeight){
$hist = array('key' => 'TareWeight', 'value' => $TareWeight, 'igr_no' => $IGRNO, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
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);
}
$hist = array('key' => 'NetWeight', 'value' => $NetWeight, 'igr_no' => $IGRNO, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
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 ;
$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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
$hist = array('key' => 'GrossWeightDate', 'value' => $GrossWtDt, 'igr_no' => $IGRNO, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
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 ;
$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);
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History id: " . $history_id);
}
$hist = array('key' => 'TareWeightDate', 'value' => $TareWtDt, 'igr_no' => $IGRNO, 'igr_item_no' => $IGRItemNo);
$this->saveIGRHistory($hist);
}
@ -1873,6 +1528,62 @@ function updateIGRWeight(){
echo json_encode($data);
}
public function saveIGRHistory($hist){
$field = $hist['key'];
$igr_no = $hist['igr_no'];
$igr_item_no = $hist['igr_item_no'];
$new_data = $hist['value'];
$old_data = NULL;
$same = false;
log_message('error', "$igr_no Save History function entered.");
// Get existing history
$existingHist = $this->inwardgateregister_model->get_igr_history($field, $igr_no, $igr_item_no);
if (!empty($existingHist)) {
foreach ($existingHist as $row) {
if ($row->new_data == $new_data) {
$same = true; // The same data already exists
break;
} else {
$old_data = $row->new_data; // Keep track of the latest `new_data`
}
}
}
if (!$same) {
// Insert or update history since data is different
$igr_history = array(
'field' => $field,
'new_data' => $new_data,
'old_data' => $old_data,
'history_dated' => get_current_date_time(),
'by' => $this->session->get('userId'),
'IGR_No' => $igr_no,
'IGRItem_No' => $igr_item_no
);
if ($old_data !== NULL) {
$igr_history['is_edit'] = 1; // Update existing record
} else {
$igr_history['is_add'] = 1; // Insert new record
}
$history_id = $this->inwardgateregister_model->igr_history($igr_history);
log_message('error', "History updated successfully. History ID: $history_id" );
} else {
// echo "No update needed: ".$param['key']." ($value) already exists.";
log_message('error', "No update needed: $field ($new_data) already exists.");
}
}

View File

@ -221,15 +221,10 @@ class Inwardgateregister_model extends Model
}
public function igr_history($hsty_arr) {
$this->db->transStart();
$builder = $this->db->table('t_igr_history');
$builder->insert($hsty_arr);
$this->db->transComplete();
if ($this->db->transStatus() === FALSE) {
return false;
} else {
return $this->db->insertID();
}
return $this->db->insertID(); // Return last inserted ID
}
function get_igr_history($col,$IGR,$IGRITEM = null)
@ -520,21 +515,7 @@ class Inwardgateregister_model extends Model
$builder = $this->db->table('t_igr_master igr')
->distinct()
->select("igr.IGRNO,igr.*,igrd.*,MM.MaterialName,MM.UOM,sup.Address,sup.SupplierName,POM.ServiceDescription,POL.Quantity,POL.Rate,POM.POType,POM.IsOpenOrder,
SUM(
CASE
WHEN POM.POType = 'IMPORT'
THEN COALESCE(it.IGST, 0)
WHEN POM.POType = 'CAPITAL' AND POM.CapitalRange = 0
THEN COALESCE(it.IGST, 0)
WHEN POM.POType = 'CAPITAL' AND POM.CapitalRange = 1
THEN COALESCE(st.CGST, 0) + COALESCE(st.SGST, 0) + COALESCE(st.IGST, 0)
WHEN POM.POType = 'REVENUE'
THEN COALESCE(rt.CGST, 0) + COALESCE(rt.SGST, 0) + COALESCE(rt.IGST, 0)
WHEN POM.POType = 'SERVICE'
THEN COALESCE(st.CGST, 0) + COALESCE(st.SGST, 0) + COALESCE(st.IGST, 0)
ELSE 0
END
) AS TaxInPercentage", false)
POM.CapitalRange,POM.CapitalRange,st.CGST as service_cgst,st.SGST as service_sgst,st.IGST as service_igst,it.IGST as import_igst,rt.CGST as revenue_cgst,rt.SGST as revenue_sgst,rt.IGST as revenue_igst")
->join('t_igr_details igrd', 'igrd.IGRNO = igr.IGRNO')
->join('t_purchaseorder_master POM', 'igr.PONO = POM.PONO')
->join('t_purchaseorder_lineitem POL', 'igr.PONO = POL.PONO and POL.MaterialCode=igrd.MaterialCode ')
@ -1172,6 +1153,7 @@ class Inwardgateregister_model extends Model
t_igr_details.QuantityAsPerInvoice as Qty,
issd.*')
->whereIn('t_igr_details.MaterialCode', $materialCodes)
->where('t_igr_details.QuantityAsPerInvoice <>', 0)
->like('t_igr_details.CreatedDate', $month, 'after');
// remark needed for those who selected any remark.
@ -1193,6 +1175,19 @@ class Inwardgateregister_model extends Model
return $result;
}
public function getHistoryDetailsforEmail($igr){
$date = date('Y-m-d H:i:s');
$to = date('Y-m-d H:i:s', strtotime($date . ' +30 seconds'));
$from = date('Y-m-d H:i:s', strtotime($date . ' -30 seconds'));
$builder = $this->db->table('t_igr_history')->where('IGR_NO', $igr)
->where('is_edit', 1)
->where('history_dated BETWEEN "'.$from.'" AND "'.$to.'"');
$query = $builder->get();
// echo $this->db->getLastQuery()->getQuery(); die;
return $query->getResult();
}
public function getDetailsforEmail($userId)
{
$query0 = $this->db->query("

View File

@ -115,7 +115,7 @@
.celda_encabezado_general {
background-color: #00a65a;
background-color:rgb(80, 187, 217); /* blue background */
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
@ -123,6 +123,10 @@
text-align: center;
min-width: 120px;
max-width: 120px;
white-space: normal; /* Allows text to wrap */
word-wrap: break-word; /* Breaks long words if needed */
text-align: center; /* Centers text for better alignment */
max-width: 150px; /* Set a max width to control wrapping */
}
.celda_encabezado_total {
@ -191,7 +195,7 @@
position: sticky;
left: 0;
top: 0;
background-color: #00a65a;
background-color:rgb(80, 187, 217); /* blue background */
z-index: 7!important;
border-right: 2px solid #ddd;
color: #ffffff;
@ -202,10 +206,11 @@
{
position: sticky;
left: 0;
background-color: #00a65a;
background-color:rgb(80, 187, 217); /* blue background */
z-index: 2;
border-right: 2px solid #ddd;
color: #ffffff;
}
.table-responsive {
@ -474,7 +479,7 @@
<!-- Modal -->
<div class="modal fade" id="coatingMachineDetailModal" tabindex="-1" role="dialog"
aria-labelledby="coatingMachineDetailModalLabel" aria-hidden="true">
<div class="modal-dialog modal-xl" style="width:1060px !important ;" role="document">
<div class="modal-dialog modal-lg" style="width:1060px !important ;" role="document">
<div class="modal-content">
<div class="modal-header">
@ -491,16 +496,22 @@
<div class="modal-body">
<div class="form-row">
<!-- date -->
<div class="form-group col-md-3">
<label for="dateId">Date</label>
<span class="badge mandatory">*</span>
<input type="date" class="form-control" id="dateId" name="date" value="" required>
</div>
<!-- shift -->
<div class="form-group col-md-3">
<label for="shiftId">Shift</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="shiftId" name="shift" value="" required>
</div>
<!-- machine on time -->
<div class="form-group col-md-3">
<label for="machineOnTimeHrId">Machine On Time</label>
<span class="badge mandatory">*</span>
@ -538,8 +549,7 @@
</div>
<!-- machine off time -->
<div class="form-group col-md-3">
<label for="machineOffTimeHrId">Machine Off Time</label>
<span class="badge mandatory">*</span>
@ -573,42 +583,14 @@
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-3">
<label for="customerNameId">Customer Name</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="customerNameId" name="customerName" value=""
required>
</div>
<div class="form-group col-md-3">
<label for="totalCoatingId">Total Coating</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalCoatingId" name="totalCoating" value=""
required>
</div>
<div class="form-group col-md-3">
<label for="totalCoatingSandId">Total Coating Sand (in Kg)</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalCoatingSandId" name="totalCoatingSandInKg"
value="" required>
</div>
<div class="form-group col-md-3">
<label for="totalGasConsumptionId">Total Gas Consumption</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalGasConsumptionId"
name="totalGasConsumption" value="" required>
</div>
</div>
<div class="form-row">
<!-- Total hours -->
<div class="form-group col-md-3">
<label for="machineRunningInHrsId"> Machine Running In Hrs</label>
<span class="badge mandatory">*</span>
@ -617,14 +599,52 @@
</div>
<!-- customer name -->
<div class="form-group col-md-3">
<label for="perHourGasConsumptionId">Per Hour Gas Consumption </label>
<label for="customerNameId">Customer Name</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="perHourGasConsumptionId"
name="perHourGasConsumption" required>
<input type="text" class="form-control" id="customerNameId" name="customerName" value=""
required>
</div>
<!-- grade -->
<div class="form-group col-md-3">
<label for="totalCoatingId">grade</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalCoatingId" name="totalCoating" value=""
required>
</div>
<!-- total coating as renamed to total production -->
<div class="form-group col-md-3">
<label for="totalCoatingId">Total Production</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalCoatingId" name="totalCoating" value=""
required>
</div>
</div>
<div class="form-row">
<!-- total coating sand in kg -->
<div class="form-group col-md-3">
<label for="totalCoatingSandId">Total Coating Sand (in Kg)</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalCoatingSandId" name="totalCoatingSandInKg"
value="" required>
</div>
<!-- total gas consumption -->
<div class="form-group col-md-3">
<label for="totalGasConsumptionId">Total Gas Consumption</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalGasConsumptionId"
name="totalGasConsumption" value="" required>
</div>
<!-- per hour Coating sand qty -->
<div class="form-group col-md-3">
<label for="perHourCoatingSandQTY">Per Hour Coating Sand QTY</label>
<span class="badge mandatory">*</span>
@ -633,8 +653,32 @@
</div>
<!-- per hour gas consumption -->
<div class="form-group col-md-3">
<label for="perHourGasConsumptionId">Per Hour Gas Consumption </label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="perHourGasConsumptionId"
name="perHourGasConsumption" required>
</div>
</div>
<div class="form-row">
<!-- batch card file upload -->
<div class="form-group col-md-3">
<label for="totalCoatingSandId">upload batch card</label>
<span class="badge mandatory">*</span>
<input type="text" class="form-control" id="totalCoatingSandId" name="totalCoatingSandInKg"
value="" required>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>

View File

@ -854,7 +854,7 @@
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = ccurrentBalanceStock == 0 ? " " : currentBalanceStock ;
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock == 0 ? " " : currentBalanceStock ;
updateStockValue( date,materialCode,currentBalanceStock )

View File

@ -264,7 +264,7 @@ foreach ($period as $day) {
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Stocks</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">Diesel Machine Stock Details </h4>
<h4 class="page-title">Diesel - Factory Vehicle </h4>
</li>
</ol>
</div>
@ -1021,7 +1021,7 @@ foreach ($period as $day) {
let runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)).toFixed(2) ;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = (runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = mileage;
@ -1046,7 +1046,7 @@ foreach ($period as $day) {
let runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)).toFixed(2) ;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = (runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = mileage;
updateStockValue(date, machine_id, closingReading)
@ -1071,7 +1071,7 @@ foreach ($period as $day) {
let runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)).toFixed(2) ;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = (runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = mileage;
updateStockValue(date, machine_id, closingReading)
@ -1247,7 +1247,7 @@ foreach ($period as $day) {
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)).toFixed(2) ;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours == 0 ? " " : runningHours ;
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours == 0 ? " " : (runningHours).toFixed(2) ;
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = mileage == 0 ? " " : mileage ;

View File

@ -352,14 +352,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th class="celda_encabezado_general" style="padding:5px;">Running Hrs</th>
<th class="celda_encabezado_general" style="padding:5px;">Supplier Name</th>
<th class="celda_encabezado_general" style="padding:5px;">Input Sand Qty</th>
<th class="celda_encabezado_general" style="padding:5px;">Input Sand Qty (Metric Ton)</th>
<th class="celda_encabezado_general" style="padding:5px;">Input Sand Moisture(%)</th>
<th class="celda_encabezado_general" style="padding:5px;">Sand Dried Qty</th>
<th class="celda_encabezado_general" style="padding:5px;">Sand Dried Qty (Metric Ton)</th>
<th class="celda_encabezado_general" style="padding:5px;">Total Gas Consumption</th>
<th class="celda_encabezado_general" style="padding:5px;">Gas Per Ton</th>
<th class="celda_encabezado_general" style="padding:5px;">Qty Per Hrs</th>
<th class="celda_encabezado_general" style="padding:5px;">Moisture Loss Qty</th>
<th class="celda_encabezado_general" style="padding:5px;">Dust Qty</th>
<th class="celda_encabezado_general" style="padding:5px;">Qty Per Hrs (Metric Ton)</th>
<th class="celda_encabezado_general" style="padding:5px;">Moisture Loss Qty (Metric Ton)</th>
<th class="celda_encabezado_general" style="padding:5px;">Dust Qty (Metric Ton)</th>
<th class="celda_encabezado_general" style="padding:5px;">Customer Name</th>
<th class="celda_encabezado_general" style="display:none;">id</th>
@ -450,7 +450,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<td class="celda_normal" oninput="gasPerTon(this);
moistureLossQty(this);
qtyPerHrs(this)" contenteditable="true">
<?php echo $a['input_sand_qty']; ?>
<?php echo (int)$a['input_sand_qty']; ?>
</td>
<!-- td:eq(6) input_sand_moisture -->
@ -462,7 +462,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<td class="celda_normal" oninput="gasPerTon(this);
moistureLossQty(this);
qtyPerHrs(this)" contenteditable="true">
<?php echo $a['sand_dried_qty']; ?>
<?php echo (int)$a['sand_dried_qty']; ?>
</td>
<!-- td:eq(8) total_gas_consumption -->
@ -479,19 +479,19 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- td:eq(10) qty_per_hours -->
<td class="celda_normal">
<?php echo $a['qty_per_hours']; ?>
<?php echo (int)$a['qty_per_hours']; ?>
</td>
<!-- td:eq(11) moisture_loss_qty -->
<td class="celda_normal">
<?php echo $a['moisture_loss_qty']; ?>
<?php echo (int)$a['moisture_loss_qty']; ?>
</td>
<!-- td:eq(12) dust_qty -->
<td class="celda_normal" contenteditable="true">
<?php echo $a['dust_qty']; ?>
<?php echo (int)$a['dust_qty']; ?>
</td>
<!-- td:eq(13) customer_name -->
@ -548,14 +548,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<th class="celda_encabezado_total" style="padding:5px;">Running Hrs</th>
<th class="celda_encabezado_total" style="padding:5px;">Supplier Name </th>
<th class="celda_encabezado_total" style="padding:5px;">input Sand Qty</th>
<th class="celda_encabezado_total" style="padding:5px;">input Sand Qty (Metric Ton)</th>
<th class="celda_encabezado_total" style="padding:5px;">inputp Sand Moisture(%)</th>
<th class="celda_encabezado_total" style="padding:5px;">Sand Dried Qty</th>
<th class="celda_encabezado_total" style="padding:5px;">Sand Dried Qty (Metric Ton)</th>
<th class="celda_encabezado_total" style="padding:5px;">Total Gas Consumption</th>
<th class="celda_encabezado_total" style="padding:5px;">Gas Per Ton</th>
<th class="celda_encabezado_total" style="padding:5px;">Qty Per Hrs</th>
<th class="celda_encabezado_total" style="padding:5px;">Moisture Loss Qty</th>
<th class="celda_encabezado_total" style="padding:5px;">Dust Qty</th>
<th class="celda_encabezado_total" style="padding:5px;">Qty Per Hrs (Metric Ton)</th>
<th class="celda_encabezado_total" style="padding:5px;">Moisture Loss Qty (Metric Ton)</th>
<th class="celda_encabezado_total" style="padding:5px;">Dust Qty (Metric Ton)</th>
</tr>
</thead>
@ -697,7 +697,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<!-- additional entries modal -->
<div class="modal fade" id="additionalEntriesModalId" tabindex="-1" role="dialog" aria-labelledby="additionalEntriesIdModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-dialog modal-xl" style="width:900px;">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="additionalEntriesIdModalLabelId">Additional Entries</h4>
@ -706,7 +706,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="modal-body">
<form action="<?php echo base_url("/addOrEditdrierMachineDetails")?>" method="POST">
<!--14 -->
<!--first row -->
<?php $calendarStartDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('first day of this month')->format('Y-m-d');?>
<?php $calendarEndDate = DateTime::createFromFormat('M-Y', $datefordropdown)->modify('last day of this month')->format('Y-m-d');?>
<div class="row">
@ -746,51 +746,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div>
</div>
<div class="row mt-2">
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value="">
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="">
</div>
<div class="col-md-3">
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="">
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryGasPerTonId">Gas per Ton</label>
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="gas_per_ton" value=""
readonly>
</div>
</div>
<!-- second row -->
<div class="row mt-2">
<div class="col-md-3">
<label class="form" for="additionalEntryDustQtyId">Dust Qty</label>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value="">
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="">
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty</label>
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="moisture_loss_qty" value=""
readonly>
</div>
<div class="col-md-3">
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value=""
readonly>
</div>
</div>
<div class="row mt-2">
<!-- supplier name -->
<div class="col-md-3">
<label class="form" for="additionalEntrySupplierNameId">Supplier Name</label>
<select class="timeDropdown supplier_name" style="width: 300px;"
@ -801,10 +761,83 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<?php } ?>
</select>
</div>
<!-- input sand qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandQtyId">Input sand Quantity (Metric Ton)</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryInputSandQtyId" name="input_sand_qty" value="">
</div>
<!-- input sand moisture -->
<div class="col-md-3">
<label class="form" for="additionalEntryInputSandMoistureId">Input Sand Moisture (%)</label>
<input type="text" class="form-control" id="additionalEntryInputSandMoistureId" name="input_sand_moisture" value="">
</div>
<!-- sand dried qty -->
<div class="col-md-3">
<label class="form" for="additionalEntrySandDriedQtyId">Sand Dried Qty (Metric Ton)</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntrySandDriedQtyId" name="sand_dried_qty" value="">
</div>
</div>
<!-- third row -->
<div class="row mt-2">
<!-- total gas consumption -->
<div class="col-md-3">
<label class="form" for="additionalEntryTotalGasConsumptionId">Total Gas Consumption</label>
<input onchange="additionalEntryGasPerTon(); additionalEntryMoistureLossQty(); additionalEntryQtyPerHrs(); "
type="text" class="form-control" id="additionalEntryTotalGasConsumptionId" name="total_gas_consumption" value="">
</div>
<!-- gas per ton -->
<div class="col-md-3">
<label class="form" for="additionalEntryGasPerTonId">Gas per Ton</label>
<input type="text" class="form-control" id="additionalEntryGasPerTonId" name="gas_per_ton" value=""
readonly>
</div>
<!-- qty per hours -->
<div class="col-md-3">
<label class="form" for="additionalEntryQtyPerHoursId">Qty per Hours</label>
<input type="text" class="form-control" id="additionalEntryQtyPerHoursId" name="qty_per_hours" value=""
readonly>
</div>
<!-- moisture loss qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryMoistureLossQtyId">Moisture Loss Qty (Metric Ton)</label>
<input type="text" class="form-control" id="additionalEntryMoistureLossQtyId" name="moisture_loss_qty" value=""
readonly>
</div>
</div>
<!-- fourth row -->
<div class="row mt-2">
<!-- dust qty -->
<div class="col-md-3">
<label class="form" for="additionalEntryDustQtyId">Dust Qty (Metric Ton)</label>
<input type="text" class="form-control" id="additionalEntryDustQtyId" name="dust_qty" value="">
</div>
<!-- customer name -->
<div class="col-md-3">
<label class="form" for="additionalEntryCustomerNameId">Customer Name</label>
<input type="text" class="form-control" id="additionalEntryCustomerNameId" name="customer_name" value="">
</div>
</div>
<button type="submit" class="btn btn-primary float-right">Add</button>
@ -1090,9 +1123,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
hours = parseInt(hours, 10);
// Adjust hours based on AM/PM
if (modifier === "PM" && hours < 12) {
if (modifier === "pm" && hours < 12) {
hours += 12;
} else if (modifier === "AM" && hours === 12) {
} else if (modifier === "am" && hours === 12) {
hours = 0;
}

View File

@ -457,7 +457,7 @@
<!-- 'td:eq(9)' -->
<td class="celda_normal" >
<?php echo $record['Qty'] ?? 0 ; ?>
<?php echo (int)$record['Qty'] ?? 0 ; ?>
</td>
<!-- 'td:eq(10)' -->
@ -575,7 +575,7 @@
<!-- 'td:eq(32)' -->
<td class="celda_normal">
<?php echo $record['salableQty'] ?? $record['Qty'] ; ?>
<?php echo $record['salableQty'] ?? (int)$record['Qty'] ; ?>
</td>
<!-- need to check the status and select values before hand -->

View File

@ -144,6 +144,13 @@
echo form_input($data);
?>
</div>
<div class="form-group col-md-3">
<label class="col-form-label">Remark</label>
<?php
$data = array('name' => 'MasterRemarks', 'value' => set_value('MasterRemarks'), 'id' => 'MasterRemarks', 'class' => 'form-control', 'autocomplete' => 'off','rows' => 3);
echo form_textarea($data);
?>
</div>
</div>
<div class="form-row">
<div class="table-responsive">
@ -152,7 +159,7 @@
<tr>
<th>#</th>
<th>Item Code</th>
<th>Material</th>
<th>Item Description</th>
<th>Rate</th>
<th>UOM</th>
<th>Ordered Quantity</th>

View File

@ -309,8 +309,8 @@
<!-- box closed here -->
<!-- Right modal content -->
<div id="right-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<!-- modal1 - IGR Remarks modal -->
<div id="right-modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-sm modal-right">
<div class="modal-content">
<div class="modal-header border-0">
@ -329,9 +329,10 @@
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<!-- /.modal fade closed (IGR Remarks)-->
<!-- Igr modal fade -->
<!-- modal2 - Edit Igr modal -->
<div id="Igrshow" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-full-width">
@ -386,13 +387,13 @@
<div class="col-md-3">
<div class="form-group">
<label class="col-form-label">Invoice Date <span class="text-danger">*</span></label>
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate" required autocomplete="off">
<input type="date" class="form-control" id="InvoiceDate" name="InvoiceDate" required autocomplete="off" style="background-color: #fff !important">
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="col-form-label">Material Received Date <span class="text-danger">*</span></label>
<input type="date" class="form-control" id="MaterialRcvdDate" name="MaterialRcvdDate" required autocomplete="off">
<input type="date" class="form-control" id="MaterialRcvdDate" name="MaterialRcvdDate" required autocomplete="off" style="background-color: #fff !important">
</div>
</div>
<div class="col-md-3">
@ -449,6 +450,15 @@
?>
</div>
</div>
<div class="col-md-3">
<div class="form-group">
<label class="col-form-label">Remark</label>
<?php
$data = array('name' => 'MasterRemarks', 'value' => set_value('MasterRemarks'), 'id' => 'MasterRemarks', 'class' => 'form-control', 'autocomplete' => 'off','rows' => 3);
echo form_textarea($data);
?>
</div>
</div>
</div>
<div class="row">
@ -457,15 +467,15 @@
<table id="Inwardgateregistertable1" class="table table-striped table-hover mb-0 editabletable IGR_Line" style="font-size:12px;">
<thead style="background-color:#ddd !important">
<tr>
<th style="width: 50px;">SNo</th>
<th style="width: 50px;">#</th>
<th style="width: 100px;">Item Code</th>
<th style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">Item Description</th>
<th style="width: 50px;">Rate</th>
<th style="width: 50px;">Tax (%)</th>
<th style="width: 50px;">UOM</th>
<th style="width: 100px;">Ordered Qty</th>
<th style="width: 100px;">Received Qty</th>
<th id="pendingQuantityHeader" style="display:none; width: 100px;">Pending Qty</th>
<th style="width: 50px;">Rate</th>
<th style="width: 50px;">Tax (%)</th>
<th style="width: 50px;">Taxable Amt</th>
<th style="width: 50px;">Total Amt</th>
<th style="width: 150px;">Remarks</th>
@ -535,10 +545,9 @@
</div>
</div>
</div>
<!-- /.modal Igr modal fade closed-->
<!-- /.modal fade closed (Edit Igr)-->
<!-- WeightCalculator modal fade -->
<!-- modal3 - Weight Calculator modal -->
<div id="WeightCalculator" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog modal-lg">
@ -614,10 +623,10 @@
</div>
</div>
</div>
</div><!-- /.modal -->
</div>
<!-- /.modal fade closed (Weight Calculator)-->
<!-- WeightCalculator modal fade closed-->
<!-- modal4 - IGR history modal -->
<div id="Historyshow" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
@ -640,10 +649,10 @@
</div>
</div>
</div>
</div><!-- /.modal -->
</div>
<!-- /.modal fade closed (IGR history)-->
<!-- History modal fade closed-->
<!-- modal5 - Cost Center modal -->
<div id="CostCentershow" class="modal fade" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
@ -667,9 +676,7 @@
</div>
</div>
</div><!-- /.modal -->
<!-- History modal fade closed-->
<!-- /.modal fade closed (Cost Center)-->
<script>
$(document).ready(function() {
@ -868,6 +875,8 @@
$("#Invoice_No").val('');
$("#InvoiceDate").val('');
$("#MaterialRcvdDate").val('');
$("#MasterRemarks").val('');
$("#Remark").val('');
$("#ser").val('');
$("#tbleIGRAppend").empty(); // Clear the table
// Hide the MasterFileLabel if no data
@ -880,7 +889,7 @@
$.each(parsedData['details'], function(i, item) {
if (igr == item.IGRNO) {
console.log(item);
console.log(item,"**");
$('#IgrshowTitle').text(" ( " + item.IGRNO + " ) ");
$("#IGRNO1").val(item.IGRNO);
$("#PONO1").val(item.PONO);
@ -905,6 +914,7 @@
$("#Supplier").val(item.SupplierName + "\n" + item.Address);
$("#Add1").val(item.Address);
$("#Invoice_No").val(item.DeliveryChellanOrInvoiceNo);
$("#MasterRemarks").val(item.Remark);
console.log(typeof item.MasterFile);
modal.find('#MasterFileLabel').hide();
if (typeof item.MasterFile == 'string') {
@ -930,11 +940,12 @@
console.log(item.MaterialRcvdDate)
var gross_rcv_date = (item.GrossWeightDate == 'null') ? ' ' : formatDateTime(item.GrossWeightDate, 2);
$("#ser").val(item.ServiceDescription);
var amount = item.Rate*item.QuantityAsPerInvoice;
var amount = item.Rate*item.QuantityAsPerInvoice;
var tax_percentage = item.TaxInPercentage;
var taxable_amount = (amount * tax_percentage) / 100;
var total_with_tax = amount + taxable_amount;
var tax_amount = (amount * tax_percentage) / 100;
var grand_total_amount = amount + tax_amount;
i = i + 1;
// userrole is system admin also know as admin (if)
if (userRole == 1) {
@ -943,15 +954,15 @@
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="Rate" id="Rate" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" name="tax">' + tax_percentage + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 50px;" name="amount">' + amount + '</td>' +
'<td style="width: 50px;" name="tax_amount">' + total_with_tax + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="'+item.Remarks+'"> </td>' +
'<td style="width: 50px;"><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="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
@ -976,25 +987,22 @@
// userrole is security based on status we show and here (else if)
else if (userRole !== 1) {
var amount = item.Rate*item.QuantityAsPerInvoice;
var tax_percentage = item.TaxInPercentage;
var taxable_amount = (amount * tax_percentage) / 100;
var total_with_tax = amount + taxable_amount;
if (igrstatus === "ST074") {
$("#pendingQuantityHeader").css("display", "table-cell");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="Rate" id="Rate" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" name="tax">' + tax_percentage + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" id="Quantity' + i + '" name="Quantity">' + parseInt(item.Quantity) + '</td>' +
'<td style="width: 100px;" data-name="sel" ><input type="text" onchange="validateReceivedQuantity(' + i + ',' + isOpenOrder + ')"id="QuantityAsPerInvoice' + i + '" name="QuantityAsPerInvoice' + i + '" value="' + parseInt(item.QuantityAsPerInvoice) + '" onkeypress="return isNumberKey(event);" style="width: 75px;"></td>' +
'<td style="width: 100px;" name="PendingQuantity' + i + '" id="PendingQuantity' + i + '">' + ((isOpenOrder) ? 0 : parseInt(item.Quantity - item.QuantityAsPerInvoice)) + '</td>' +
'<td style="width: 50px;" name="amount">' + amount + '</td>' +
'<td style="width: 50px;" name="tax_amount">' + total_with_tax + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;"> </td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 100px;"><input type="text" id="Remark' + i + '" name="Remark' + i + '" class="form" onchange="SetRemarks(' + i + ')" style="width: 75px;" value="'+item.Remarks+'"> </td>' +
'<td style="width: 50px;"><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="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
@ -1017,23 +1025,18 @@
} else {
var amount = item.Rate*item.QuantityAsPerInvoice;
var tax_percentage = item.TaxInPercentage;
var taxable_amount = (amount * tax_percentage) / 100;
var total_with_tax = amount + taxable_amount;
$("#pendingQuantityHeader").css("display", "none");
trIGRHTML += '<tr>' +
'<td style="width: 50px;" >' + i + '</td>' +
'<td style="width: 100px;" name="MaterialName" id="MaterialCode" onchange="test(' + i + ')">' + item.MaterialCode + '</td>' +
'<td style="width: 150px; word-wrap: break-word; word-break: break-all; white-space: normal;">' + item.MaterialName + '</td>' +
'<td style="width: 50px;" name="Rate" id="Rate" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" name="tax">' + tax_percentage + '</td>' +
'<td style="width: 50px;" name="UOM">' + item.UOM + '</td>' +
'<td style="width: 100px;" name="Quantity">' + item.Quantity + '</td>' +
'<td style="width: 100px;" data-name="sel" >' + item.QuantityAsPerInvoice + '</td>' +
'<td style="width: 50px;" name="tax_amount">' + total_with_tax + '</td>' +
'<td style="width: 50px;" name="amount">' + amount + '</td>' +
'<td style="width: 50px;" name="tax_amount">' + total_with_tax + '</td>' +
'<td style="width: 50px;" id="Rate' + i + '" >' + Number(item.Rate).toFixed(2) + '</td>' +
'<td style="width: 50px;" id="tax_percentage' + i + '">' + tax_percentage + '</td>' +
'<td style="width: 50px;" id="amount' + i + '">' + amount + '</td>' +
'<td style="width: 50px;" id="grand_total_amount' + i + '">' + grand_total_amount + '</td>' +
'<td style="width: 50px;"><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="MaterialCode' + i + '" name="MaterialCode' + i + '" value="' + item.MaterialCode + '">' +
@ -1215,6 +1218,8 @@
formData.append('tableData', JSON.stringify(tableData));
formData.append('isOpenOrder', $("#hiddenIsOpenOrder").val());
formData.append('MasterFile', $('#MasterFile')[0].files[0]);
formData.append('MasterRemarks', $("#MasterRemarks").val());
$('input[name="file_name[]"]').each(function() {
formData.append('file_name[]', $(this).val());
@ -1607,13 +1612,32 @@
}
function validateReceivedQuantity(Rowid, isOpenOrder) {
console.log("validation");
var InvoiceQty = parseFloat($('#QuantityAsPerInvoice' + Rowid).val() || '0.00'); // working fine
var OrderedQty = parseFloat($("#Quantity" + Rowid).text());
var Rate = parseFloat($('#Rate' + Rowid).text() || '0.00');
console.log('#Rate' + Rowid+" Rate:", Rate);
var amount = Rate * InvoiceQty;
console.log('#amount' + Rowid+" amount:", amount);
var tax_percentage = parseFloat($('#tax_percentage' + Rowid).text() || '0.00');
var tax_amount = (amount * tax_percentage) / 100;
console.log('#tax_amount' + Rowid+" tax_amount:", tax_amount);
var grand_total_amount = amount + tax_amount; // tax_amount
console.log('#grand_total_amount' + Rowid+" grand_total_amount:", grand_total_amount);
if (isOpenOrder == 1) {
var PendingQty = 0;
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
$('#amount' + Rowid).text(amount);
$('#tax_amount' + Rowid).text(tax_amount);
$('#grand_total_amount' + Rowid).text(grand_total_amount);
return true;
} else {
if (parseInt(OrderedQty) !== 0) {
@ -1624,12 +1648,18 @@
} else if ((InvoiceQty) - OrderedQty > 0.00) {
alert("Order is completed.");
$("#QuantityAsPerInvoice" + Rowid).focus().val('');
$('#amount' + Rowid).text(amount);
$('#tax_amount' + Rowid).text(tax_amount);
$('#grand_total_amount' + Rowid).text(grand_total_amount);
return false;
} else {
var PendingQty = OrderedQty - (InvoiceQty);
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
$('#amount' + Rowid).text(amount);
$('#tax_amount' + Rowid).text(tax_amount);
$('#grand_total_amount' + Rowid).text(grand_total_amount);
return true;
}
} else {
@ -1637,6 +1667,9 @@
$('#PendingQuantity' + Rowid).text(PendingQty.toFixed(0));
$('#txtPendingQty' + Rowid).val(PendingQty.toFixed(0));
$('#txtQuantityAsPerInvoice' + Rowid).val(InvoiceQty.toFixed(2));
$('#amount' + Rowid).text(amount);
$('#tax_amount' + Rowid).text(tax_amount);
$('#grand_total_amount' + Rowid).text(grand_total_amount);
return true;
}
}