private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) return; string warehouseName = string.Empty; try { var dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) return; ReceiptID = Convert.ToInt32(dr["ReceiptID"]); var receiptDoc = new BLL.Receipt(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receiptDoc.LoadByPrimaryKey(ReceiptID); var GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"]; lblPONo.Text = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString()); lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString(); txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString(); var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID); txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo; txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo; txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo; txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name; lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName; lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName; lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName; lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString(); lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString(); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString(); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString(); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString(); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString(); var user = new User(); user.LoadByPrimaryKey(receiptDoc.SavedByUserID); lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString(); lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString(); if (!receiveDoc.IsColumnNull("ConfirmedByUserID")) { user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID); lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; } else { lblConfirmedBy.Text = "-"; } var space = string.Empty; var length = warehouseName.Length; HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo; } gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } catch { gridDetails.DataSource = null; } }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); if (e != null && e.PrevFocusedRowHandle < -1) { return; } string warehouseName = string.Empty; try { var dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { return; } ReceiptID = Convert.ToInt32(dr["ReceiptID"]); var receiptDoc = new BLL.Receipt(); var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receiptDoc.LoadByPrimaryKey(ReceiptID); var GRNFDetail = receiptDoc.GetDetailsForGRNF(); if (GRNFDetail.Rows.Count > 0) { txtOrderNo.EditValue = dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"]; lblPONo.Text = (dr["PONumber"] == DBNull.Value ? "-" : dr["PONumber"].ToString()); lblCluster.Text = dr["ClusterName"] == DBNull.Value ? "-" : dr["ClusterName"].ToString(); txtWarehouse.EditValue = lblWarehouse.Text = warehouseName = dr["WarehouseName"] == DBNull.Value ? "-" : dr["WarehouseName"].ToString(); var receiptInvoice = new ReceiptInvoice(receiptDoc.ReceiptInvoiceID); txtInvoiceNo.EditValue = lblInvoiceNo.Text = String.IsNullOrEmpty(receiptInvoice.STVOrInvoiceNo) ? "-" : receiptInvoice.STVOrInvoiceNo; txtInsurance.EditValue = lblInsurancePolicy.Text = String.IsNullOrEmpty(receiptInvoice.InsurancePolicyNo) ? "-" : receiptInvoice.InsurancePolicyNo; txtTransfer.EditValue = lblTransferVoucherNo.Text = String.IsNullOrEmpty(receipt.TransitTransferNo) ? "-" : receipt.TransitTransferNo; txtWayBill.EditValue = lblWayBill.Text = String.IsNullOrEmpty(receiptInvoice.WayBillNo) ? "-" : receiptInvoice.WayBillNo; var activity = new Activity(); activity.LoadByPrimaryKey(Convert.ToInt32(dr["StoreID"])); txtActivity.EditValue = activity.FullActivityName; lblActivity.Text = String.IsNullOrEmpty(activity.Name) ? "-" : activity.Name; lblSubAccount.Text = String.IsNullOrEmpty(activity.SubAccountName) ? "-" : activity.SubAccountName; lblAccount.Text = String.IsNullOrEmpty(activity.AccountName) ? "-" : activity.AccountName; lblMode.Text = String.IsNullOrEmpty(activity.ModeName) ? "-" : activity.ModeName; lblReceiveType.Text = dr["ReceiptType"] == DBNull.Value ? "-" : dr["ReceiptType"].ToString(); lblReceiveStatus.Text = dr["Status"] == DBNull.Value ? "-" : dr["Status"].ToString(); lblDocumentType.Text = dr["DocumentType"] == DBNull.Value ? "-" : dr["DocumentType"].ToString(); lblPOType.Text = dr["POType"] == DBNull.Value ? "-" : dr["POType"].ToString(); lblPaymentType.Text = dr["PaymentType"] == DBNull.Value ? "-" : dr["PaymentType"].ToString(); lblReceiptNo.Text = dr["ReceiptNo"] == DBNull.Value ? "-" : dr["ReceiptNo"].ToString(); lblSupplier.Text = dr["Supplier"] == DBNull.Value ? "-" : dr["Supplier"].ToString(); var user = new User(); user.LoadByPrimaryKey(receiptDoc.SavedByUserID); lblReceivedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); lblReceivedDate.Text = receiptDoc.IsColumnNull("DateOfEntry") ? "-" :receiveDoc.EurDate.ToShortDateString(); lblConfirmedDate.Text = receiveDoc.IsColumnNull("ConfirmedDateTime") ? "-" : receiveDoc.ConfirmedDateTime.ToShortDateString(); if (!receiveDoc.IsColumnNull("ConfirmedByUserID")) { user.LoadByPrimaryKey(receiveDoc.ConfirmedByUserID); lblConfirmedBy.Text = String.IsNullOrEmpty(user.FullName) ? "-" : user.FullName; } else { lblConfirmedBy.Text = "-"; } var space = string.Empty; var length = warehouseName.Length; HeaderGroup.Text = warehouseName + space.PadRight(180 - length) + "Invoice No: " + receiptInvoice.STVOrInvoiceNo; } gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); } catch { gridDetails.DataSource = null; } }
private void LoadData(int ReceiptID, int InvoiceID, int PoID) { //PO Cost Elements; purchaseOrder.LoadByPrimaryKey(PoID); Invoice.LoadByPrimaryKey(InvoiceID); GRV.LoadByPrimaryKey(ReceiptID); if (Invoice.IsColumnNull("InvoiceTypeID")) { Invoice.InvoiceTypeID = ReceiptInvoiceType.InvoiceType.NON_STANDARD; } if (Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.INVOICE_SEA) { UseSeaFreight = true; } else { UseSeaFreight = false; } if (!purchaseOrder.IsColumnNull("TotalValue")) { PurchaseOrderTotal = purchaseOrder.TotalValue; } if (!purchaseOrder.IsColumnNull("AirFreight")) { PurchaseOrderAirFreight = purchaseOrder.AirFreight; } if (!purchaseOrder.IsColumnNull("SeaFreight")) { PurchaseOrderSeaFreight = purchaseOrder.SeaFreight; } if (!purchaseOrder.IsColumnNull("Insurance")) { PurchaseOrderInsurance = purchaseOrder.Insurance; } if (!purchaseOrder.IsColumnNull("NBE")) { PurcahseOrderNBE = purchaseOrder.NBE; } //Invoice Cost Elements; if (!Invoice.IsColumnNull("TotalValue")) { InvoiceTotal = Invoice.TotalValue; } if (!Invoice.IsColumnNull("AirFreight")) { InvoiceAirFreight = Invoice.AirFreight; } if (!Invoice.IsColumnNull("SeaFreight")) { InvoiceSeaFreight = Invoice.SeaFreight; } if (!Invoice.IsColumnNull("InlandFreight")) { InvoiceInlandFreight = Invoice.InlandFreight; } if (!Invoice.IsColumnNull("Insurance")) { InvoiceInsurance = Invoice.Insurance; } if (!Invoice.IsColumnNull("NBE")) { InvoiceNBE = Invoice.NBE; } if (!Invoice.IsColumnNull("CBE")) { InvoiceCBE = Invoice.CBE; } if (!Invoice.IsColumnNull("CustomDutyTax")) { InvoiceCustomDutyTax = Invoice.CustomDutyTax; } //GRV Cost Elements if (UseSeaFreight) { if (!GRV.IsColumnNull("SeaFreight")) { GRVSeaFreight = GRV.SeaFreight; } } else { if (!GRV.IsColumnNull("AirFreight")) { GRVAirFreight = GRV.AirFreight; } } if (!GRV.IsColumnNull("InlandFreight")) { GRVInlandFreight = GRV.InlandFreight; } if (!GRV.IsColumnNull("Insurance")) { GRVInsurance = GRV.Insurance; } if (!GRV.IsColumnNull("NBE")) { GRVNBE = GRV.NBE; } if (!GRV.IsColumnNull("CBE")) { GRVCBE = GRV.CBE; } if (!GRV.IsColumnNull("CustomDutyTax")) { GRVCustomDutyTax = GRV.CustomDutyTax; } if (!GRV.IsColumnNull("TransitServiceCharge")) { GRVTransit = GRV.TransitServiceCharge; } else { GRVTransit = UseTransitServiceCharge ? 250 : 0; } //if (!GRV.IsColumnNull("OtherExpenses")) // GRVOtherExpense = GRV; //Exchange rate if (!purchaseOrder.IsColumnNull("ExhangeRate")) { FOBExchangeRate = purchaseOrder.ExhangeRate; } if (!Invoice.IsColumnNull("ExchangeRate")) { FreightExchangeRate = Invoice.ExchangeRate; } }