/// <summary> /// Adds the new receipt. /// </summary> /// <param name="receiptTypeID">The receipt type ID.</param> /// <param name="userID">The user ID.</param> /// <param name="receiptInvoiceID">The receipt invoice ID.</param> /// /// <param name="receiptStatusID">The receipt confirmation status ID.</param> /// <returns></returns> public int AddNewReceipt(int receiptTypeID, int warehouseID, int userID, int receiptInvoiceID, string txtTransitTransferVoucherNoOverride, int receiptStatusID) //, string transitTransferNo, string insurancePolicyNo, string wayBillNo) { this.AddNew(); this.DateOfEntry = DateTimeHelper.ServerDateTime; this.ReceiptTypeID = receiptTypeID; this.SavedByUserID = userID; this.WarehouseID = warehouseID; this.ReceiptInvoiceID = receiptInvoiceID; this.ReceiptStatusID = receiptStatusID; BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(receiptInvoiceID); this.STVOrInvoiceNo = rctInvoice.STVOrInvoiceNo; if (string.IsNullOrEmpty(txtTransitTransferVoucherNoOverride)) { this.TransitTransferNo = rctInvoice.TransitTransferNo; } else { this.TransitTransferNo = txtTransitTransferVoucherNoOverride; } this.InsurancePolicyNo = rctInvoice.InsurancePolicyNo; this.WayBillNo = rctInvoice.WayBillNo; this.Save(); return(this.ID); }
public DataTable GetRelatedReceives() { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetRelatedReceives(this.ID); invoice.LoadFromRawSql(query); return(invoice.DataTable); }
public bool CheckIfThisInvoiceHasBeenReceived() { var invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectIfThisInvoiceHasBeenReceived(ID); invoice.LoadFromRawSql(query); return(invoice.RowCount > 0); }
public void LoadByReceiptID(int receiptID) { BLL.Receipt rct = new Receipt(); rct.LoadByPrimaryKey(receiptID); BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); this.LoadByPrimaryKey(rctInvoice.POID); }
public static bool IsInvoiceEditable(int ID) { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectIsInvoiceEditable(ID, Settings.DisableInvoiceEditAfterStepNo); invoice.LoadFromRawSql(query); return(invoice.RowCount == 0); }
private void btnInvoice_Click(object sender, EventArgs e) { BLL.Receipt GRV = new BLL.Receipt(); GRV.LoadByPrimaryKey(ReceiptID); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); ReceiptInvoiceDialog InvoiceDialog = new ReceiptInvoiceDialog(invoice.POID, invoice.ID); InvoiceDialog.ShowDialog(); LoadSelectedGRVDetailForCostBuildUp(ReceiptID); }
public static DataView GetIncompleteInvoicesForCenter(int userID, bool isDeliveryNote) { var invoice = new ReceiptInvoice(); if (BLL.Settings.IsCenter) // If Center, Get incomplete invoices including those with FOB = 0 { var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetIncompleteInvoicesForCenter(userID, isDeliveryNote); invoice.LoadFromRawSql(query); } return(invoice.DefaultView); }
public void LoadCostBuilUp(bool AutoProrate, string GRNFString) { //ToDo: Remove the Setting Before Implementation _CostBuildup = new CostBuildup(); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); _CostBuildup.UseTransitServiceCharge = false; _CostBuildup.AutoProrate = AutoProrate; _CostBuildup.LoadByReceiptIDInvoiceIDAndPoID(ReceiptID, invoice.ID, invoice.POID, GRNFString, _SubTotal); }
public static bool IsInvoiceElectronic(string invoiceNo) { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectIsInvoiceElectronic(invoiceNo); invoice.LoadFromRawSql(query); if (invoice.RowCount == 0) { return(false); } return((bool)invoice.GetColumn("IsElectronic")); }
public static decimal GetInvoiceQuantity(string invoiceNo, string itemId, string unitId, string manufacturerId) { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetInvoiceQuantity(invoiceNo, itemId, unitId, manufacturerId); invoice.LoadFromRawSql(query); if (invoice.RowCount == 0) { return(0); } return((decimal)invoice.GetColumn("Quantity")); }
public string GetNewInvoiceNoForConvertedDeliveryNote() { var receiptInvoice = new ReceiptInvoice(ReceiptInvoiceID); if (!receiptInvoice.IsConvertedFromDeliveryNote) { return(null); } var receipt = new Receipt(); string query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetReprintedInvoice(ReceiptInvoiceID); receipt.LoadFromRawSql(query); return(receipt.STVOrInvoiceNo); }
public void SaveAirFreight(double Freight) { ReceiptInvoice receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); if (receiptInvoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.INVOICE_SEA) { _Freight = Freight; GRV.SeaFreight = _Freight; } else if (receiptInvoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.INVOICE_AIR) { _Freight = Freight; GRV.AirFreight = _Freight; } GRV.Save(); LoadGRV(GRV.ID); }
/// <summary> /// Gets the total sounded item. /// </summary> /// <returns></returns> public double GetTotalSoundedItem() { double TotalSoundedItem = 0; LoadSoundpGRV(); try { foreach (DataRowView drv in _pGRVSound) { TotalSoundedItem += Convert.ToDouble(drv["PricePerPack"]) * Convert.ToInt32(drv["NoOfPack"]); } return(TotalSoundedItem + ReceiptInvoice.GetFreight(TotalSoundedItem)); } catch { return(0); } }
/// <summary> /// It will return all Invoice For Now /// </summary> /// <returns></returns> public static DataView GetIncompleteInvoices(int userID, int poTypeID, int documentTypeID) { SoftwareSettings softwareSetting = new SoftwareSettings(); ReceiptInvoice Invoice = new ReceiptInvoice(); var settingDT = softwareSetting.GetValue("IsElectronicReceiveOnly"); bool isNonElectronicReceiveOnly = true; if (settingDT.Rows.Count != 0) { isNonElectronicReceiveOnly = bool.Parse(settingDT.Rows[0].Field <string>("Value").ToLower()); } var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetIncompleteInvoices(userID, isNonElectronicReceiveOnly, poTypeID, documentTypeID); Invoice.LoadFromRawSql(query); return(Invoice.DefaultView); }
public DataView CostAnalysis(string pGRVNo) { Receipt receipt = new Receipt(ReceiptID); PO PO = receipt.ReceiptInvoice.PO; ReceiptInvoice receiptInvoice = receipt.ReceiptInvoice; ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); Activity activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); JournalEntry UnitCostJournal = new JournalEntry(activity.AccountName, activity.SubAccountName, activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo); double GIT = _GrandTotalCost; //When insurance is included (_TotalLandedCost-_GrandTotal) is the price effect cauzed by rounding double PriceDifference = Math.Round(_PriceDifference - _PriceDifferenceIns, Settings.NoOfDigitsAfterTheDecimalPoint); if (receiveDoc.ReturnedStock) { double stock = Math.Round(GetGrandTotalForSRM(), 2); return(SRMCostAnalysis(UnitCostJournal, _CommodityType, stock, stock, ReceiptID)); } UnitCostJournal.AddNewEntry("Stock (" + _CommodityType + ")", Math.Round(_GrandTotalCost + PriceDifference, Settings.NoOfDigitsAfterTheDecimalPoint), null); if (PriceDifference > 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry( "Account Payable (" + GetAccountPayableCorrectNameByAccount(_Supplier) + ")", null, Math.Round(_GrandTotalCost, Settings.NoOfDigitsAfterTheDecimalPoint)); return(UnitCostJournal.DefaultView()); }
public static Receipt CreateAutomaticReceiptInvoiceForSTVTransfer(int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.IsDeliveryNote = false; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(BLL.ReceiptType.CONSTANTS.STANDARD_RECEIPT, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return(receipt); }
public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); var po = new BLL.PO(); po.LoadByPrimaryKey(POID); var activityID = po.StoreID; //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.SavedByUserID = userID; rctInvoice.ActivityID = activityID; rctInvoice.IsDeliveryNote = false; rctInvoice.InvoiceTypeID = BLL.InvoiceType.InternalSTV; rctInvoice.PrintedDate = DateTimeHelper.ServerDateTime; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return(receipt); }
public bool CheckIfThisInvoiceHasBeenReceived() { var invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectIfThisInvoiceHasBeenReceived(ID); invoice.LoadFromRawSql(query); return (invoice.RowCount > 0); }
public DataTable GetRelatedReceives() { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetRelatedReceives(this.ID); invoice.LoadFromRawSql(query); return invoice.DataTable; }
public DataView CostAnalysis(string pGRVNo) { Receipt receipt = new Receipt(ReceiptID); PO PO = receipt.ReceiptInvoice.PO; ReceiptInvoice receiptInvoice = receipt.ReceiptInvoice; ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); Activity activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); JournalEntry UnitCostJournal = new JournalEntry(activity.AccountName, activity.SubAccountName, activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo); double SupplierClaim = Convert.ToDouble(GetSupplierClaim()); double InsuranceClaim = Convert.ToDouble(GetInsuranceClaim()); double Provision = Convert.ToDouble(Math.Round(CostBuildUp.Provision, 2)); double GrandTotal = Math.Round(GetGrandTotal(), 2); double PriceDifference = Math.Round(_PriceDifference, 2); double Bonus = Convert.ToDouble(Math.Round(_Bonus, 2)); //Request from Mery Formula Provide by Phone //Wednesday October 10 double GIT = Math.Round(GrandTotal + SupplierClaim + InsuranceClaim + _PriceDifference - Provision - Convert.ToDouble(Bonus), 2); // trying out Sprout Method to Handle if (receiveDoc.ReturnedStock) { double stock = Math.Round(GetGrandTotalForSRM(), 2); return(SRMCostAnalysis(UnitCostJournal, _CommodityType, stock, stock, ReceiptID)); } if (POType.GetModes(PO.PurchaseType) == POType.STANDARD && CostBuildUp.Invoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE && CostBuildUp.Invoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.CIP) { UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", _CommodityType), GrandTotal, null); UnitCostJournal.AddNewEntry("ClaimFromSupplier", SupplierClaim, null); UnitCostJournal.AddNewEntry("ClaimFromInsurance", InsuranceClaim, null); if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else if (PriceDifference > 0) { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry("GIT", null, GIT); UnitCostJournal.AddNewEntry("Provision", null, Provision); if (Bonus > 0) { UnitCostJournal.AddNewEntry("Other Income", null, Math.Abs(Bonus)); } } else if (activity.IsHealthProgram()) { UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", _CommodityType), Math.Round(GrandTotal, Settings.NoOfDigitsAfterTheDecimalPoint), null); if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else if (PriceDifference > 0) { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry(String.Format("Net Asset ({0})", _Supplier), null, Math.Round(GrandTotal - PriceDifference - Bonus, Settings.NoOfDigitsAfterTheDecimalPoint)); if (Bonus > 0) { UnitCostJournal.AddNewEntry("Other Income", null, Math.Abs(Bonus)); } } else { UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", _CommodityType), Math.Round(GrandTotal, Settings.NoOfDigitsAfterTheDecimalPoint), null); if (PriceDifference > 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry(String.Format("Account Payable ({0})", _Supplier), null, Math.Round(GIT - Convert.ToDouble(GetTotalDamagedAndShortlanded()) - Bonus, Settings.NoOfDigitsAfterTheDecimalPoint)); if (Bonus > 0) { UnitCostJournal.AddNewEntry("Other Income", null, Math.Abs(Bonus)); } } return(UnitCostJournal.DefaultView()); }
/// <summary> /// Costs the analysis. /// </summary> /// <param name="pGRVNo">The p GRV no.</param> /// <returns></returns> public DataView CostAnalysis(string pGRVNo) { GetGrandTotal(); PO PO = ReceiptInvoice.PO; ReceiptInvoice receiptInvoice = ReceiptInvoice; Activity Activity = new Activity(); Activity.LoadByPrimaryKey(receiptInvoice.ActivityID); double GIT = TotalLandedCost - Provision; JournalEntry UnitCostJournal = new JournalEntry(Activity.AccountName, Activity.SubAccountName, Activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo); double PriceDifference = Math.Round(TotalLandedCost - this.GrandTotal, BLL.Settings.NoOfDigitsAfterTheDecimalPoint); if (BLL.Settings.IsCenter) { if (this.ReceiptInvoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE && this.ReceiptInvoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.CIP) { UnitCostJournal.AddNewEntry("Stock", GrandTotal, null); UnitCostJournal.AddNewEntry("ClaimFromSupplier", GetSupplierClaim(), null); UnitCostJournal.AddNewEntry("ClaimFromInsurance", GetInsuranceClaim(), null); if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry("GIT", null, GIT); UnitCostJournal.AddNewEntry("Provision", null, Provision); UnitCostJournal.AddNewEntry("Other Income", null, 0); } else { UnitCostJournal.AddNewEntry("Stock", GrandTotal, null); if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry("Account Payable ", null, GIT); } } else { UnitCostJournal.AddNewEntry("Stock", GrandTotal, null); if (PriceDifference < 0) { UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference)); } else if (PriceDifference > 0) { UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null); } UnitCostJournal.AddNewEntry("Account Payable ", null, GIT); } return(UnitCostJournal.DefaultView()); }
private void BindInvoiceDetail(ReceiptInvoice receiptInvoice) { _dtReceiptInvoiceDetail.Rows.Clear(); var receiptInvoiceDetail = new ReceiptInvoiceDetail(); receiptInvoiceDetail.LoadByReceiptInvoice(receiptInvoice.ID); if (receiptInvoiceDetail.DefaultView.Count == 0) { BindInvoiceDetailByPO(receiptInvoice.POID); } else { receiptInvoiceDetail.LoadMergedPOAndInvoiceDetails(receiptInvoice.ID); foreach (DataRowView rowView in receiptInvoiceDetail.DefaultView) { var newrow = _dtReceiptInvoiceDetail.NewRow(); newrow["FullItemName"] = rowView["FullItemName"]; newrow["Unit"] = rowView["Unit"]; newrow["Manufacturer"] = rowView["Manufacturer"]; newrow["OrderedQuantity"] = rowView["OrderedQuantity"]; newrow["OrderedAmount"] = rowView["Amount"]; newrow["ItemID"] = Convert.ToInt32(rowView["ItemID"]); newrow["UnitOfIssueID"] = Convert.ToInt32(rowView["UnitOfIssueID"]); newrow["ManufacturerID"] = Convert.ToInt32(rowView["ManufacturerID"]); if (rowView["ExpiryDate"] != DBNull.Value) { newrow["ExpiryDate"] = Convert.ToDateTime(rowView["ExpiryDate"]); } newrow["IsSaved"] = false; newrow["GUID"] = Guid.NewGuid(); if (rowView["InvoicedQuantity"] != DBNull.Value) { newrow["ReceiptInvoiceDetailID"] = Convert.ToInt32(rowView["ReceiptInvoiceDetailID"]); newrow["ReceiptInvoiceID"] = Convert.ToInt32(rowView["ReceiptInvoiceID"]); newrow["BatchNumber"] = rowView["BatchNumber"]; newrow["InvoicedQty"] = Convert.ToDecimal(rowView["InvoicedQuantity"]); newrow["UnitPrice"] = Convert.ToDecimal(rowView["UnitPrice"]); newrow["Margin"] = Convert.ToDecimal(rowView["Margin"]); newrow["IsSaved"] = true; } else { newrow["UnitPrice"] = 0; newrow["Margin"] = 0; } _dtReceiptInvoiceDetail.Rows.Add(newrow); } MergeReceiptInvoiceDetailGUID(); _dtReceiptInvoiceDetail.DefaultView.Sort = "FullItemName, Unit, Manufacturer, ExpiryDate DESC, BatchNumber DESC"; gridInvoiceDetail.DataSource = _dtReceiptInvoiceDetail; if (receiptInvoice.CheckIfThisInvoiceHasBeenReceived()) { gridInvoiceDetail.Enabled = btnSave.Enabled = false; tabInvoice.SelectedTabPageIndex = 0; XtraMessageBox.Show("This Invoice has a related Receive!,You can't edit in this case!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void PrintReceiptConfirmation(string referenceNumber, int? reprintOfReceiptConfirmationPrintoutID) { var rc = new ReceiptConfirmationPrintout(); var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName; rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 3, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); srmPrintout.DataSource = rc.DefaultView.ToTable(); var rUnit = new Institution(); var idoc = new IssueDoc(); if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { idoc.LoadByPrimaryKey(receiveDoc.ReturnedFromIssueDocID); rUnit.LoadByPrimaryKey(idoc.ReceivingUnitID); } else { var po = new PO(); po.LoadByReceiptID(receiveDoc.ReceiptID); rUnit.LoadByPrimaryKey(int.Parse(po.RefNo)); } srmPrintout.xrFromValue.Text = rUnit.Name; srmPrintout.xrWoredaValue.Text = rUnit.WoredaText; srmPrintout.xrRegionValue.Text = rUnit.Region; srmPrintout.xrZoneValue.Text = rUnit.ZoneText; if (!receiveDoc.IsColumnNull("ReturnedFromIssueDocID")) { var stvLog = new BLL.Issue(); stvLog.LoadByPrimaryKey(idoc.STVID); srmPrintout.xrIssueDateValue.Text = idoc.Date.ToString("M/d/yyyy"); var activity = new Activity(); activity.LoadByPrimaryKey(idoc.StoreId); srmPrintout.xrAccountName.Text = activity.FullActivityName; var rct = new BLL.Receipt(); rct.LoadByPrimaryKey(ReceiptID); var rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); srmPrintout.xrSTVNoValue.Text = rctInvoice.STVOrInvoiceNo; } else { var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); srmPrintout.xrAccountName.Text = activity.FullActivityName; srmPrintout.xrSTVNoValue.Text = receiveDoc.RefNo; } var dtDate = new DateTimePickerEx(); dtDate.Value = receiveDoc.EurDate; srmPrintout.Date.Text = dtDate.Text; if (srmPrintout.PrintDialog() != DialogResult.OK) { throw new Exception("Print cancelled by user!"); } //Successfully printed //Release Product var GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); var recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); }
private void btnSTV_Click(object sender, EventArgs e) { BLL.Receipt receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); receipt.STVOrInvoiceNo = txtSTVNo.EditValue.ToString(); receipt.Save(); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); invoice.STVOrInvoiceNo = txtSTVNo.EditValue.ToString(); invoice.Save(); this.LogActivity("Set-New-STV-No", ReceiptID); XtraMessageBox.Show("STV Number has been saved"); }
private void btnSaveInvoice_Click(object sender, EventArgs e) { PO po = new PO(_orderID); if (dxValidation.Validate()) { ReceiptInvoice invoice = new ReceiptInvoice(); if (_receiptInvoiceID != 0) { invoice.LoadByPrimaryKey(_receiptInvoiceID); } else { invoice.AddNew(); } //TODO: save the Invoice Type Here. invoice.InvoiceTypeID = 1; invoice.InsurancePolicyNo = txtInsurance.Text; double TotalValue = 0; if (!invoice.IsColumnNull("TotalValue")) { TotalValue = invoice.TotalValue; } if (_receiptInvoiceID != 0 && po.Remaining + TotalValue < Convert.ToDouble(txtTotalValue.EditValue) && POType.GetModes(po.PurchaseType) == POType.STANDARD) { XtraMessageBox.Show("Invoice value can't be be greater than Order value", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } invoice.TotalValue = Convert.ToDouble(txtTotalValue.EditValue); if (po.Remaining < invoice.TotalValue && POType.GetModes(po.PurchaseType) == POType.STANDARD && _receiptInvoiceID == 0) { XtraMessageBox.Show("Invoice value can't be be greater than Order value", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } invoice.WayBillNo = txtWayBill.Text; invoice.TransitTransferNo = txtTransitNumber.Text; invoice.STVOrInvoiceNo = txtInvoiceNumber.Text; invoice.POID = _orderID; invoice.SavedByUserID = CurrentContext.UserId; invoice.AirFreight = Convert.ToDouble(txtInvoiceAirFreight.EditValue); invoice.SeaFreight = Convert.ToDouble(txtInvoiceSeaFreight.EditValue); invoice.InlandFreight = Convert.ToDouble(txtInvoiceInlandFreight.EditValue); invoice.CustomDutyTax = Convert.ToDouble(txtInvoiceCustomDutyTax.EditValue); invoice.CBE = Convert.ToDouble(txtInvoiceCBEServiceCharge.EditValue); invoice.InvoiceTypeID = Convert.ToInt32(lkInvoiceType.EditValue); invoice.DateOfEntry = Convert.ToDateTime(dtInvoiceDate.EditValue); invoice.ExchangeRate = Convert.ToDouble(txtExchangeRate.EditValue); invoice.LCID = Convert.ToInt32(lkCurrencyLCID.EditValue); invoice.ActivityID = po.StoreID; invoice.Rowguid = Guid.NewGuid(); invoice.PrintedDate = dtInvoiceDate.DateTime; invoice.IsVoided = false ; invoice.ShippingSite = " "; invoice.IsConvertedFromDeliveryNote = false; invoice.IsDeliveryNote = Convert.ToInt32(lkDocumentType.EditValue) == DocumentType.CONSTANTS.DLVN; if (Convert.ToInt32(lkDocumentType.EditValue) != -1) invoice.DocumentTypeID = Convert.ToInt32(lkDocumentType.EditValue); invoice.Save(); this.LogActivity("Save-Invoice", invoice.ID); lblInvoiceNoDetail.Text = txtInvoiceNumber.EditValue.ToString(); lblInvoiceTypeDetail.Text = lkInvoiceType.Text; BLL.Receipt receipt = new BLL.Receipt(); receipt.UpdateInvoiceRelatedHeaders(invoice); _receiptInvoiceID = invoice.ID; MessageBox.Show("Invoice saved!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); HeaderGroupDetail.Text = "Invoice No: " + txtInvoiceNumber.EditValue.ToString(); } }
private void lkReceiptInvoice_EditValueChanged(object sender, EventArgs e) { ResetFields(); if (lkReceiptInvoice.EditValue != null) { if ((standardRecType == StandardReceiptType.iGRVOnline || deliveryNoteType == DeliveryNoteType.Automatic) && lkReceiptInvoice.EditValue.Equals(-1)) { HandleReceiptTypeChange(true); return; } if (standardRecType == StandardReceiptType.iGRV && !lkReceiptInvoice.EditValue.Equals(-1)) { //This means, the hub has chosen an invoice other than "Not Found" from the list of invoices. Therefore, we want to change the receipt type to be iGRV-Online. HandleReceiptTypeChange(); } BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(Convert.ToInt32(lkReceiptInvoice.EditValue)); var po = new PO(); po.LoadByPrimaryKey(rctInvoice.POID); if (po.IsElectronic == true) { rdIsElectronic.Checked = true; lblSyncDate.Text = rctInvoice.DateOfEntry.ToShortDateString(); txtPassCode.Enabled = true; lcPassCode.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } else { rdIsElectronic.Checked = false; lblSyncDate.Text = "-"; txtPassCode.Enabled = false; lcPassCode.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } lblOrderNo.Text = po.PONumber; lblOrderNum.Text = po.PONumber; if (!rctInvoice.IsColumnNull("DocumentTypeID")) { var doctype = new BLL.DocumentType(); doctype.LoadByPrimaryKey(rctInvoice.DocumentTypeID); lblDeliveryNote.Text = doctype.Name; lblHeaderDoc.Text = doctype.Name; } else { lblDeliveryNote.Text = "-"; lblHeaderDoc.Text = "-"; } var mode = new Mode(); mode.LoadByPrimaryKey(po.ModeID); lblMode.Text = mode.TypeName; lblAccount.Text = "-"; lblSubAccount.Text = "-"; lblActivity.Text = "-"; lblReferenceNo.Text = po.RefNo; var payment = new PaymentType(); payment.LoadByPrimaryKey(po.PaymentTypeID); lblPaymentType.Text = payment.Name; lblHeaderPayment.Text = payment.Name; //if (po.IsColumnNull("NBE")) //{ // lblNebService.Text = Convert.ToString(po.NBE); //} //else //{ // lblNebService.Text = "-"; //} if (po.Remaining != -1) lblRemainingValue.Text = po.Remaining.ToString(); else lblRemainingValue.Text = "-"; if (po.TotalValue != -1) lblTotalValue.Text = po.Remaining.ToString(); else lblTotalValue.Text = "-"; if (po.Insurance != -1) lblChargeInsurance.Text = po.Insurance.ToString(); else lblChargeInsurance.Text = "-"; if (po.NBE != -1) lblNebService.Text = po.NBE.ToString(); else lblNebService.Text = "-"; lblOrderDate.Text = po.PODate.ToShortDateString(); lblReceiptDate.Text = rctInvoice.DateOfEntry.ToShortDateString(); var user = new User(); user.LoadByPrimaryKey(po.SavedbyUserID); lblOrderBy.Text = user.FullName; var sup = new Supplier(); lkAccounts.EditValue = rctInvoice.ActivityID; var act = new Activity(); act.LoadByPrimaryKey(rctInvoice.ActivityID); _supplierID = rctInvoice.GetSupplier(); sup.LoadByPrimaryKey(_supplierID); lblSupplier.Text = sup.CompanyName; lblOrdSup.Text = sup.CompanyName; lblInvoiceNo.Text = rctInvoice.STVOrInvoiceNo; lblInvAccount.Text = act.AccountName ?? "-"; lblInvActivity.Text = act.Name ?? "-"; lblAct.Text = act.FullActivityName ?? "-"; lblInvSubAccount.Text = act.SubAccountName ?? "-"; lblInvMode.Text = act.ModeName ?? "-"; lblInvTotalValue.Text = rctInvoice.TotalFOBValue.ToString("N"); lblInsurancePolicy.Text = rctInvoice.InsurancePolicyNo == " "? rctInvoice.InsurancePolicyNo : "-"; var poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); lblOrderType.Text = poType.Name ?? "-"; lblPOType.Text = poType.Name ?? "-"; var poStatus = new PurchaseOrderStatus(); poStatus.LoadByPrimaryKey(po.PurchaseOrderStatusID); lblOrderStatus.Text = poStatus.Name ?? "-"; var it = new InvoiceType(); it.LoadByPrimaryKey(rctInvoice.InvoiceTypeID); lblInvType.Text = it.Name; lblInvDate.Text = rctInvoice.DateOfEntry.ToShortDateString(); mode.LoadByPrimaryKey(rctInvoice.ActivityID); lblWayBillNo.Text = rctInvoice.WayBillNo; txtTransitTransferVoucherNo.Text = rctInvoice.TransitTransferNo; txtEditTransferNo.Text = rctInvoice.TransitTransferNo; lblInsurancePolicyNo.Text = rctInvoice.InsurancePolicyNo; BLL.PO order = new PO(); order.LoadByPrimaryKey(rctInvoice.POID); lblRefNo.Text = order.RefNo; lblPoNo.Text = order.PONumber; DataTable relatedReceives = rctInvoice.GetRelatedReceives(); hasPreviousReceive = false; if (relatedReceives.Rows.Count > 0) { XtraMessageBox.Show( "The Invoice you have selected has previous associated receives", "Invoice Detail", MessageBoxButtons.OK, MessageBoxIcon.Warning); colSelectedManufactuerer.Visible = true; colSelectedUnit.Visible = true; colSelectionLineNo.Visible = true; colSelectedReceiveQty.Visible = true; colSelectedInvoiceQty.Visible = true; hasPreviousReceive = true; gridItemsChoice.Enabled = false; colRemainingQty.VisibleIndex = 9; lcItemChoiceGrid.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; _dtSelectedTable = relatedReceives.Clone(); gridSelected.DataSource = _dtSelectedTable; foreach (DataRow dr in relatedReceives.Rows) { SelectAnItem(dr); } } else { hasPreviousReceive = false; colSelectedManufactuerer.Visible = false; colSelectedUnit.Visible = false; colSelectionLineNo.Visible = false; colSelectedReceiveQty.Visible = false; colSelectedInvoiceQty.Visible = false; colRemainingQty.Visible = false; gridItemsChoice.Enabled = true; lcItemChoiceGrid.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; } if (lkAccounts.EditValue != null) { // lcInvoiceDetail.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } if (standardRecType == StandardReceiptType.iGRVOnline || standardRecType == StandardReceiptType.GRV || deliveryNoteType == DeliveryNoteType.Automatic) { if (!hasPreviousReceive) LoadItemsFromTransferredReceiptInvoiceDetail(rctInvoice.ID); txtRefNo.Text = lkReceiptInvoice.Text; colSelectedReceiveQty.Visible = true; lcItemChoiceGrid.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; lkAccounts.Enabled = false; } else { lkAccounts.Enabled = !BLL.Settings.IsCenter; } if(!BLL.Settings.IsCenter) { //Passcode Textbox var dataRowView = lkReceiptInvoice.GetSelectedDataRow() as DataRowView; if (dataRowView != null) _isElectronic = Convert.ToBoolean(dataRowView["IsElectronic"]); lcPassCode.Visibility = (!_isNonElectronicReceiveOnly) && (_isElectronic) && (standardRecType == StandardReceiptType.iGRVOnline || deliveryNoteType == DeliveryNoteType.Automatic) ? LayoutVisibility.Always : LayoutVisibility.Never; txtPassCode.Text = "HHMM"; } } }
private int SaveRelevantReceiptHeaders(int receiptTypeID, int warehouseID) { int receiptID; var receipt = new BLL.Receipt(); var sup = new BLL.Supplier(); if (lkReceiptInvoice.EditValue != null && Convert.ToInt32(lkReceiptInvoice.EditValue) != -1) { receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, CurrentContext.UserId, Convert.ToInt32(lkReceiptInvoice.EditValue), txtEditTransferNo.Text, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); // , txtTransitNo.Text, txtInsuranceNo.Text, txtWayBillNo.Text); } else { //PO and ReceiptInvoice created automatically. //Needs to be fixed. BLL.PO po = new PO(); BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); po.AddNew(); var serverDateTime = DateTimeHelper.ServerDateTime; po.PODate = serverDateTime; po.DateOfEntry = serverDateTime; po.PurchaseType = POType.INVENTORY; po.IsElectronic = false; po.POFinalized = false; po.Rowguid = Guid.NewGuid(); po.Identifier = "00000"; po.PaymentTypeID = BLL.PaymentType.Constants.STV; po.TermOfPayement = BLL.PaymentTerm.Internal; po.PurchaseOrderStatusID = PurchaseOrderStatus.Processed; rctInvoice.AddNew(); po.StoreID = Convert.ToInt32(lkAccounts.EditValue); Activity acc = new Activity(); acc.LoadByPrimaryKey(po.StoreID); po.ModeID = acc.ModeID; //po.PONumber = srm ? lkSTVInvoiceNo.EditValue.ToString() : (deliveryNote ? txtRefNo.Text : (beginningBalance ? "BeginningBalance" : String.Empty)); if (lcSTVNo.Visibility == DevExpress.XtraLayout.Utils.LayoutVisibility.Always) { po.PONumber = srm && !chkSRMForOldSystemIssues.Checked ? txtSTVNo.Text : ((deliveryNoteType != DeliveryNoteType.NotSet) ? txtSTVNo.Text : (beginningBalance ? "BeginningBalance" : (srm && chkSRMForOldSystemIssues.Checked ? txtSTVInvoiceNoOldSystem.Text : txtRefNo.Text))); } else { po.PONumber = srm && !chkSRMForOldSystemIssues.Checked ? lkSTVInvoiceNo.Text : ((deliveryNoteType != DeliveryNoteType.NotSet) ? txtRefNo.Text : (beginningBalance ? "BeginningBalance" : (srm && chkSRMForOldSystemIssues.Checked ? txtSTVInvoiceNoOldSystem.Text : txtRefNo.Text))); } //TODO: Ugly hack, supplier. To be fixed. if (srm) { po.SupplierID = BLL.Supplier.CONSTANTS.RETURNED_FROM_FACILITY; //Let's put Finance Required stuff here. po.Insurance = 0; po.ExhangeRate = 1; rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.InvoiceTypeID = ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE; if (chkSRMForOldSystemIssues.Checked) { if (lkForFacility.EditValue == null) throw new Exception("Facility not chosen!"); po.RefNo = lkForFacility.EditValue.ToString(); } } po.SavedbyUserID = CurrentContext.LoggedInUser.ID; po.Save(); rctInvoice.POID = po.ID; if (lcSTVNo.Visibility == DevExpress.XtraLayout.Utils.LayoutVisibility.Always) { rctInvoice.STVOrInvoiceNo = srm && !chkSRMForOldSystemIssues.Checked ? txtSTVNo.Text : ((deliveryNoteType != DeliveryNoteType.NotSet) ? txtSTVNo.Text : (beginningBalance ? "BeginningBalance" : (srm && chkSRMForOldSystemIssues.Checked ? txtSTVInvoiceNoOldSystem.Text : txtSTVNo.Text))); } else { rctInvoice.STVOrInvoiceNo = srm && !chkSRMForOldSystemIssues.Checked ? lkSTVInvoiceNo.Text : ((deliveryNoteType != DeliveryNoteType.NotSet) ? txtRefNo.Text : (beginningBalance ? "BeginningBalance" : (srm && chkSRMForOldSystemIssues.Checked ? txtSTVInvoiceNoOldSystem.Text : txtRefNo.Text))); } rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.ActivityID = po.StoreID; rctInvoice.SavedByUserID = CurrentContext.LoggedInUser.ID; rctInvoice.IsDeliveryNote = false; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.PrintedDate = po.DateOfEntry; rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.IsDeliveryNote = false; rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.SRM; rctInvoice.Save(); receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, CurrentContext.UserId, rctInvoice.ID, txtTransitTransferVoucherNo.Text, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); //receiptID = receipt.AddNewReceipt(receiptTypeID, NewMainWindow.UserId); } return receiptID; }
private bool IsFirstTabValid() { // check if the receive is being saved with a future date // it can receive date +1 if (dtRecDate.Value > BLL.DateTimeHelper.ServerDateTime) { XtraMessageBox.Show("You cannot receive in a future date. please correct the date and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } if (!dxValidateAccount.Validate()) { //XtraMessageBox.Show("Please select Account!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return false; } //Check if Supplier is selected if (!srm && !beginningBalance) { if (BLL.Settings.IsCenter && !dxValidateReceiveInvoice.Validate()) { return false; } } if (dxValidatePassCode.Validate() && _isElectronic && !_isNonElectronicReceiveOnly) { if (standardRecType.Equals(StandardReceiptType.iGRVOnline) || deliveryNoteType == DeliveryNoteType.Automatic) { if (dxValidatePassCode.Validate()) { var receipt = new ReceiptInvoice(); receipt.GetPrintedDate(Convert.ToInt32(lkReceiptInvoice.EditValue)); var printedDate = (DateTime)receipt.GetColumn("PrintedDate"); try { var hourAndminute = printedDate.ToString("h:mm tt").Split(' ')[0].Replace(":", string.Empty); if (hourAndminute != txtPassCode.Text) { XtraMessageBox.Show( "Value entered in the pass code is not correct. Please enter the printed Hour and Minute from the STV .", "Pass Code Incorrect"); return false; } } catch (FormatException ex) { XtraMessageBox.Show( "Value format entered in the pass code is not correct. Please use this format : mm/dd/yyyy", "Pass Code Incorrect"); return false; } } else { return false; } } } return true; }
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; } }
/// <summary> /// Initializes a new instance of the <see cref="Receipt" /> class. /// </summary> /// <param name="ID">The ID.</param> public Receipt(int ID) { LoadByPrimaryKey(ID); _receiptInvoice = new ReceiptInvoice(ReceiptInvoiceID); ConvertNull(); }
public void LoadByReceiptIDInvoiceIDAndPoID(int ReceiptID, int InvoiceID, int PoID, string GRNString,double GRVTotalValue) { purchaseOrder = new PO(); Invoice = new ReceiptInvoice(); GRV = new Receipt(); //Load this.GRVTotal = GRVTotalValue; LoadData(ReceiptID, InvoiceID, PoID); _activity = new Activity(); _activity.LoadByPrimaryKey(Invoice.ActivityID); Supplier = purchaseOrder.Supplier.CompanyName; OrderNo = purchaseOrder.PONumber; InvoiceNo = Invoice.STVOrInvoiceNo; GRVNo = GRNString; AWBNo = Invoice.WayBillNo; ShippedBy = Invoice.ShippedBy; if (Invoice.IsColumnNull("InvoiceTypeID") || GRV.ReceiptTypeID == ReceiptType.CONSTANTS.STOCK_RETURN) { AutoProrate = false; purchaseOrder.ExhangeRate = FOBExchangeRate = 1; } else if (Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.NON_STANDARD) { AutoProrate = false; purchaseOrder.ExhangeRate = FOBExchangeRate = 1; } else { if (purchaseOrder.PurchaseType == POType.COST_AND_EST_FREIGHT) { ProrateUsingFreightOnPO = true; ProrateUsingFreightOnInvoice = true; UsePOFreight = true; } else if (purchaseOrder.PurchaseType == POType.COST_AND_FREIGHT) { ProrateUsingFreightOnPO = true; ProrateUsingFreightOnInvoice = true; UsePOFreight = false; } } if (!_activity.IsHealthProgram()) UseCustomDutyTax = true; if (AutoProrate && Invoice.InvoiceTypeID != -255 && Invoice.InvoiceTypeID != InvoiceType.Internal) Prorate(); if (Invoice.IsColumnNull("InvoiceTypeID") || Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE || Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.CIP || Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.NON_STANDARD || _activity.IsHealthProgram()) UseProvison = false; else UseProvison = true; CalculateCostCoefficient(); PopulateDataTable(); }
private void BindInvoiceDetail(ReceiptInvoice receiptInvoice) { _dtReceiptInvoiceDetail.Rows.Clear(); var receiptInvoiceDetail = new ReceiptInvoiceDetail(); receiptInvoiceDetail.LoadByReceiptInvoice(receiptInvoice.ID); if (receiptInvoiceDetail.DefaultView.Count == 0) { BindInvoiceDetailByPO(receiptInvoice.POID); } else { receiptInvoiceDetail.LoadMergedPOAndInvoiceDetails(receiptInvoice.ID); foreach (DataRowView rowView in receiptInvoiceDetail.DefaultView) { var newrow = _dtReceiptInvoiceDetail.NewRow(); newrow["FullItemName"] = rowView["FullItemName"]; newrow["Unit"] = rowView["Unit"]; newrow["Manufacturer"] = rowView["Manufacturer"]; newrow["OrderedQuantity"] = rowView["OrderedQuantity"]; newrow["OrderedAmount"] = rowView["Amount"]; newrow["ItemID"] = Convert.ToInt32(rowView["ItemID"]); newrow["UnitOfIssueID"] = Convert.ToInt32(rowView["UnitOfIssueID"]); newrow["ManufacturerID"] = Convert.ToInt32(rowView["ManufacturerID"]); if (rowView["ExpiryDate"] != DBNull.Value) { newrow["ExpiryDate"] = Convert.ToDateTime(rowView["ExpiryDate"]); } newrow["IsSaved"] = false; newrow["GUID"] = Guid.NewGuid(); if (rowView["InvoicedQuantity"] != DBNull.Value) { newrow["ReceiptInvoiceDetailID"] = Convert.ToInt32(rowView["ReceiptInvoiceDetailID"]); newrow["ReceiptInvoiceID"] = Convert.ToInt32(rowView["ReceiptInvoiceID"]); newrow["BatchNumber"] = rowView["BatchNumber"]; newrow["InvoicedQty"] = Convert.ToDecimal(rowView["InvoicedQuantity"]); newrow["UnitPrice"] = Convert.ToDecimal(rowView["UnitPrice"]); newrow["Margin"] = Convert.ToDecimal(rowView["Margin"]); newrow["IsSaved"] = true; } else { newrow["UnitPrice"] = 0; newrow["Margin"] = 0; } _dtReceiptInvoiceDetail.Rows.Add(newrow); } MergeReceiptInvoiceDetailGUID(); _dtReceiptInvoiceDetail.DefaultView.Sort = "FullItemName, Unit, Manufacturer, ExpiryDate DESC, BatchNumber DESC"; gridInvoiceDetail.DataSource = _dtReceiptInvoiceDetail; if (receiptInvoice.CheckIfThisInvoiceHasBeenReceived()) { gridInvoiceDetail.Enabled = btnSave.Enabled = false; tabInvoice.SelectedTabPageIndex = 0; XtraMessageBox.Show("This Invoice has a related Receive!,You can't edit in this case!", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void ReceiptInvoiceDialog_Load(object sender, EventArgs e) { InitializeForm(); LayoutAndBindingByAccess(); LoadDecimalFormatings(); ConstructTableColumns(); gridViewInvoiceDetail.RowStyle += new RowStyleEventHandler(gridInvoiceDetail_RowStyle); lkInvoiceType.Properties.DataSource = BLL.Settings.IsCenter ? ReceiptInvoiceType.GetAllInvoiceTypes() : ReceiptInvoiceType.GetAllInvoiceTypeByCode("INT"); //Internal for Hubs lkInvoiceType.EditValue = BLL.Settings.IsCenter ? -1 : ReceiptInvoiceType.InvoiceType.INTERNAL; lkCurrencyLCID.Properties.DataSource = Helpers.FormattingHelpers.GetCurrencyList(); var etb = Convert.ToInt32(Helpers.FormattingHelpers.GetCurrencyList().ToTable().Select("Symbol = 'ETB'")[0]["ID"]); lkCurrencyLCID.EditValue = etb; //ETB is the default value PO Order = new PO(_orderID); if (_orderID != 0) { Activity act = new Activity(); act.LoadByPrimaryKey(Order.StoreID); lblAccount.Text = act.AccountName; lblAccountDetail.Text = act.AccountName; lblSubAccount.Text = act.SubAccountName; lblSubAccountDetail.Text = act.SubAccountName; lblActivity.Text = act.Name; lblActivityDetail.Text = act.Name; lblPOType.Text = POType.GetPOTypeNameByID(Order.PurchaseType); lblPOTypeDetail.Text = POType.GetPOTypeNameByID(Order.PurchaseType); lblPONumberDetail.Text = Order.PONumber.ToString(); //lblInvoiceNoDetail.Text = var poStatus = new PurchaseOrderStatus(); poStatus.LoadByPrimaryKey(Order.PurchaseOrderStatusID); lblOrderStatus.Text = poStatus.Name; var Mode = new Mode(); Mode.LoadByPrimaryKey(Order.ModeID); lblMode.Text = Mode.TypeName; lblModeDetail.Text = Mode.TypeName; var receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadForPO(_orderID); try { lblInvoiceNoDetail.Text = !receiptInvoice.IsColumnNull("STVOrInvoiceNo") ? receiptInvoice.STVOrInvoiceNo : "-"; } catch (Exception) { lblInvoiceNoDetail.Text = "-"; } var invoiceType = new ReceiptInvoiceType(); HeaderGroup.Text = "PO No: " + Order.PONumber; } //documentType var po = new PO(_orderID); var documentTypes = BLL.DocumentType.GetDocumentTypesByPOType(po.PurchaseType); lkDocumentType.Properties.DataSource = documentTypes; lkDocumentType.EditValue = documentTypes.Rows.Count > 0 ? documentTypes.Rows[0]["DocumentTypeID"] : -1; if (_receiptInvoiceID != 0) { ReceiptInvoice rinvoice = new ReceiptInvoice(_receiptInvoiceID); //bind data to invoicedetail tab BindInvoiceDetail(rinvoice); lblOrderNumber.Text = rinvoice.PO.PONumber; lblSupplier.Text = rinvoice.PO.Supplier.IsActive ? rinvoice.PO.Supplier.CompanyName : ""; lblRefNo.Text = rinvoice.PO.RefNo != "" ? rinvoice.PO.RefNo : "-"; gridGrv.DataSource = rinvoice.Receipts.DefaultView; txtInsurance.Text = rinvoice.InsurancePolicyNo; txtInvoiceNumber.Text = rinvoice.STVOrInvoiceNo; txtTransitNumber.Text = rinvoice.TransitTransferNo; txtWayBill.Text = rinvoice.WayBillNo; dtInvoiceDate.EditValue = !rinvoice.IsColumnNull("DateofEntry") ? rinvoice.DateOfEntry : DateTimeHelper.ServerDateTime; txtTotalValue.EditValue = !rinvoice.IsColumnNull("TotalValue") ? rinvoice.TotalValue : 0; lkInvoiceType.EditValue = !rinvoice.IsColumnNull("InvoiceTypeID") ? rinvoice.InvoiceTypeID : 0; txtInvoiceAirFreight.EditValue = !rinvoice.IsColumnNull("AirFreight") ? rinvoice.AirFreight : 0; txtInvoiceSeaFreight.EditValue = !rinvoice.IsColumnNull("SeaFreight") ? rinvoice.SeaFreight : 0; txtInvoiceInlandFreight.EditValue = !rinvoice.IsColumnNull("InlandFreight") ? rinvoice.InlandFreight : 0; txtInvoiceCustomDutyTax.EditValue = !rinvoice.IsColumnNull("CustomDutyTax") ? rinvoice.CustomDutyTax : 0; txtInvoiceCBEServiceCharge.EditValue = !rinvoice.IsColumnNull("CBE") ? rinvoice.CBE : 0; txtExchangeRate.EditValue = !rinvoice.IsColumnNull("ExchangeRate") ? rinvoice.ExchangeRate : 1; lkCurrencyLCID.EditValue = _currency = !rinvoice.IsColumnNull("LCID") ? rinvoice.LCID : 0; lkDocumentType.EditValue = !rinvoice.IsColumnNull("DocumentTypeID") ? rinvoice.DocumentTypeID : -1; DisableEditDependingOnSetting(); var activity = new Activity(); activity.LoadByPrimaryKey(rinvoice.ActivityID); if (activity.IsHealthProgram()) { txtInvoiceCustomDutyTax.EditValue = 0; txtInvoiceCustomDutyTax.Enabled = false; } // var receiptINvoice = new ReceiptInvoice(); // receiptINvoice.LoadForPO(_orderID); lblInvoiceNoDetail.Text = rinvoice.STVOrInvoiceNo.ToString(); lblInvoiceTypeDetail.Text = lkInvoiceType.Text; } else { PO PO = new PO(_orderID); lblOrderNumber.Text = PO.PONumber; BindInvoiceDetailByPO(PO.ID); lblSupplier.Text = PO.Supplier.IsActive ? PO.Supplier.CompanyName : "_"; lkCurrencyLCID.EditValue = 1118; //ETB is the dafault lblRefNo.Text = PO.RefNo != "" ? PO.RefNo : "-"; if (PO.StoreID != null) { var activity = new Activity(); activity.LoadByPrimaryKey(po.StoreID); if (activity.IsHealthProgram()) { txtInvoiceCustomDutyTax.EditValue = 0; txtInvoiceCustomDutyTax.Enabled = false; } } layoutGoodsReceived.Enabled = false; } //gridViewInvoiceDetail.ValidateRow += GridViewInvoiceDetailOnValidateRow; }
public void SaveAirFreight(double Freight) { ReceiptInvoice receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); if (receiptInvoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.INVOICE_SEA) { _Freight = Freight; GRV.SeaFreight = _Freight; } else if (receiptInvoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.INVOICE_AIR) { _Freight = Freight; GRV.AirFreight = _Freight; } GRV.Save(); LoadGRV(GRV.ID); }
private void ReceiptInvoiceDialog_Load(object sender, EventArgs e) { InitializeForm(); LayoutAndBindingByAccess(); LoadDecimalFormatings(); ConstructTableColumns(); gridViewInvoiceDetail.RowStyle += new RowStyleEventHandler(gridInvoiceDetail_RowStyle); lkInvoiceType.Properties.DataSource = BLL.Settings.IsCenter ? ReceiptInvoiceType.GetAllInvoiceTypes() : ReceiptInvoiceType.GetAllInvoiceTypeByCode("INT"); //Internal for Hubs lkInvoiceType.EditValue = BLL.Settings.IsCenter ? -1 : ReceiptInvoiceType.InvoiceType.INTERNAL; lkCurrencyLCID.Properties.DataSource = Helpers.FormattingHelpers.GetCurrencyList(); var etb = Convert.ToInt32(Helpers.FormattingHelpers.GetCurrencyList().ToTable().Select("Symbol = 'ETB'")[0]["ID"]); lkCurrencyLCID.EditValue = etb; //ETB is the default value PO Order = new PO(_orderID); if (_orderID != 0) { Activity act = new Activity(); act.LoadByPrimaryKey(Order.StoreID); lblAccount.Text = act.AccountName; lblAccountDetail.Text = act.AccountName; lblSubAccount.Text = act.SubAccountName; lblSubAccountDetail.Text = act.SubAccountName; lblActivity.Text = act.Name; lblActivityDetail.Text = act.Name; lblPOType.Text = POType.GetPOTypeNameByID(Order.PurchaseType); lblPOTypeDetail.Text = POType.GetPOTypeNameByID(Order.PurchaseType); lblPONumberDetail.Text = Order.PONumber.ToString(); //lblInvoiceNoDetail.Text = var poStatus = new PurchaseOrderStatus(); poStatus.LoadByPrimaryKey(Order.PurchaseOrderStatusID); lblOrderStatus.Text = poStatus.Name; var Mode = new Mode(); Mode.LoadByPrimaryKey(Order.ModeID); lblMode.Text = Mode.TypeName; lblModeDetail.Text = Mode.TypeName; var receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadForPO(_orderID); try { lblInvoiceNoDetail.Text = !receiptInvoice.IsColumnNull("STVOrInvoiceNo") ? receiptInvoice.STVOrInvoiceNo : "-"; } catch (Exception) { lblInvoiceNoDetail.Text = "-"; } var invoiceType = new ReceiptInvoiceType(); HeaderGroup.Text = "PO No: " + Order.PONumber; } //documentType var po = new PO(_orderID); var documentTypes = BLL.DocumentType.GetDocumentTypesByPOType(po.PurchaseType); lkDocumentType.Properties.DataSource = documentTypes; lkDocumentType.EditValue = documentTypes.Rows.Count > 0 ? documentTypes.Rows[0]["DocumentTypeID"] : -1; if (_receiptInvoiceID != 0) { ReceiptInvoice rinvoice = new ReceiptInvoice(_receiptInvoiceID); //bind data to invoicedetail tab BindInvoiceDetail(rinvoice); lblOrderNumber.Text = rinvoice.PO.PONumber; lblSupplier.Text = rinvoice.PO.Supplier.IsActive ? rinvoice.PO.Supplier.CompanyName : ""; lblRefNo.Text = rinvoice.PO.RefNo != "" ? rinvoice.PO.RefNo : "-"; gridGrv.DataSource = rinvoice.Receipts.DefaultView; txtInsurance.Text = rinvoice.InsurancePolicyNo; txtInvoiceNumber.Text = rinvoice.STVOrInvoiceNo; txtTransitNumber.Text = rinvoice.TransitTransferNo; txtWayBill.Text = rinvoice.WayBillNo; dtInvoiceDate.EditValue = !rinvoice.IsColumnNull("DateofEntry") ? rinvoice.DateOfEntry : DateTimeHelper.ServerDateTime; txtTotalValue.EditValue = !rinvoice.IsColumnNull("TotalValue") ? rinvoice.TotalValue : 0; lkInvoiceType.EditValue = !rinvoice.IsColumnNull("InvoiceTypeID") ? rinvoice.InvoiceTypeID : 0; txtInvoiceAirFreight.EditValue = !rinvoice.IsColumnNull("AirFreight") ? rinvoice.AirFreight : 0; txtInvoiceSeaFreight.EditValue = !rinvoice.IsColumnNull("SeaFreight") ? rinvoice.SeaFreight : 0; txtInvoiceInlandFreight.EditValue = !rinvoice.IsColumnNull("InlandFreight") ? rinvoice.InlandFreight : 0; txtInvoiceCustomDutyTax.EditValue = !rinvoice.IsColumnNull("CustomDutyTax") ? rinvoice.CustomDutyTax : 0; txtInvoiceCBEServiceCharge.EditValue = !rinvoice.IsColumnNull("CBE") ? rinvoice.CBE : 0; txtExchangeRate.EditValue = !rinvoice.IsColumnNull("ExchangeRate") ? rinvoice.ExchangeRate : 1; lkCurrencyLCID.EditValue = _currency = !rinvoice.IsColumnNull("LCID") ? rinvoice.LCID : 0; lkDocumentType.EditValue = !rinvoice.IsColumnNull("DocumentTypeID") ? rinvoice.DocumentTypeID : -1; DisableEditDependingOnSetting(); var activity = new Activity(); activity.LoadByPrimaryKey(rinvoice.ActivityID); if (activity.IsHealthProgram()) { txtInvoiceCustomDutyTax.EditValue = 0; txtInvoiceCustomDutyTax.Enabled = false; } // var receiptINvoice = new ReceiptInvoice(); // receiptINvoice.LoadForPO(_orderID); lblInvoiceNoDetail.Text = rinvoice.STVOrInvoiceNo.ToString(); lblInvoiceTypeDetail.Text = lkInvoiceType.Text; } else { PO PO = new PO(_orderID); lblOrderNumber.Text = PO.PONumber; BindInvoiceDetailByPO(PO.ID); lblSupplier.Text = PO.Supplier.IsActive ? PO.Supplier.CompanyName : "_"; lkCurrencyLCID.EditValue = 1118; //ETB is the dafault lblRefNo.Text = PO.RefNo != "" ? PO.RefNo : "-"; if (PO.StoreID != null) { var activity = new Activity(); activity.LoadByPrimaryKey(po.StoreID); if (activity.IsHealthProgram()) { txtInvoiceCustomDutyTax.EditValue = 0; txtInvoiceCustomDutyTax.Enabled = false; } } layoutGoodsReceived.Enabled = false; } //gridViewInvoiceDetail.ValidateRow += GridViewInvoiceDetailOnValidateRow; }
public static void SaveList(List<HCMIS.Desktop.STVSyncService.STVList> list, int userID) { BLL.ReceiptInvoice bv = new BLL.ReceiptInvoice(); foreach (HCMIS.Desktop.STVSyncService.STVList v in list) { // try to load by primary key bv.LoadBySTVNoAndAccountType(v.STVNo, v.AccountID); // if the entry doesn't exist, create it if (bv.RowCount == 0) { BLL.PO po = new BLL.PO(); po.AddNew(); if (v.AccountID.HasValue) po.StoreID = v.AccountID.Value; po.SupplierID = BLL.Supplier.CONSTANTS.HOME_OFFICE; if (v.HubID.HasValue) po.PONumber = v.HubID.Value + "-" + v.STVNo; po.Save(); bv.AddNew(); bv.STVOrInvoiceNo = v.STVNo.ToString(); bv.InvoiceTypeID = BLL.ReceiptInvoiceType.InvoiceType.STV; bv.DateOfEntry = DateTimeHelper.ServerDateTime; bv.POID = po.ID; bv.SavedByUserID = userID; } // populate the contents of v on the to the database list bv.TotalValue = v.InvoiceTotalValue; bv.Insurance = v.Insurance; bv.SavedByUserID = userID; bv.Save(); } }
private HCMIS.Desktop.Reports.ReceiptConfirmationPrintout PrintReceiptConfirmation(int ReceiptID, int? reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); BLL.Receipt receipt=new BLL.Receipt(); receipt.LoadByPrimaryKey(receiveDoc.ReceiptID); BLL.ReceiptInvoice receiptInvoice= new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receipt.ReceiptInvoiceID); BLL.PO po = new PO(); po.LoadByPrimaryKey(receiptInvoice.POID); BLL.POType poType = new POType(); poType.LoadByPrimaryKey(po.PurchaseType); int printedID = 0; string GRNFNo = FiscalYear.Current.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID)); if (currentMode == Modes.GRVPrinting) //The GRVConfirmation is for reprinting { printout.BranchName.Text = GeneralInfo.Current.HospitalName; PrepareGRVPrintout(printout); // String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); if (poType.PurchaseOrderTypeCode == "LP") printout.xrGRVLabel.Text = "GRV No."; else printout.xrGRVLabel.Text = "iGRV No."; if (supplier.SupplierTypeID == SupplierType.CONSTANTS.HOME_OFFICE || supplier.SupplierTypeID == SupplierType.CONSTANTS.HUBS || supplier.SupplierTypeID == SupplierType.CONSTANTS.ACCOUNTS || supplier.SupplierTypeID == SupplierType.CONSTANTS.STORES) { //printout.xrGRVLabel.Text = "iGRV No."; printout.xrAir.Visible = false; printout.xrAirValue.Visible = false; printout.xrTransit.Visible = false; printout.xrTransitValue.Visible = false; printout.xrInsurance.Visible = false; printout.xrInsuranceValue.Visible = false; printout.xrNumberOfCases.Visible = false; printout.xrNumberOfCasesValue.Visible = false; printout.xrInvoiceNo.Text = "STV No."; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrLabelGRNF.Text = GRNFNo; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 4, null,reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } else { // printout.xrGRVLabel.Text = "GRV No."; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printedID = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 2, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); printout.xrLabelGRNF.Text = GRNFNo; printout.DataSource = rc.DefaultView.ToTable(); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } } printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(ReceiptID, printedID); if (currentMode == Modes.GRVPrinting) PrepareGRVPrintout(printoutShortage); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Printed"); BindFormContents(); // LOG Cost Analysis printout in PDF Log MemoryStream stream = new MemoryStream(); printout.ExportToPdf(stream); HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "GRV/IGRV", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime); return printout; }
public static bool IsInvoiceEditable(int ID) { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectIsInvoiceEditable(ID, Settings.DisableInvoiceEditAfterStepNo); invoice.LoadFromRawSql(query); return invoice.RowCount == 0; }
private void btnSaveInvoice_Click(object sender, EventArgs e) { PO po = new PO(_orderID); if (dxValidation.Validate()) { ReceiptInvoice invoice = new ReceiptInvoice(); if (_receiptInvoiceID != 0) { invoice.LoadByPrimaryKey(_receiptInvoiceID); } else { invoice.AddNew(); } //TODO: save the Invoice Type Here. invoice.InvoiceTypeID = 1; invoice.InsurancePolicyNo = txtInsurance.Text; double TotalValue = 0; if (!invoice.IsColumnNull("TotalValue")) { TotalValue = invoice.TotalValue; } if (_receiptInvoiceID != 0 && po.Remaining + TotalValue < Convert.ToDouble(txtTotalValue.EditValue) && POType.GetModes(po.PurchaseType) == POType.STANDARD) { XtraMessageBox.Show("Invoice value can't be be greater than Order value", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } invoice.TotalValue = Convert.ToDouble(txtTotalValue.EditValue); if (po.Remaining < invoice.TotalValue && POType.GetModes(po.PurchaseType) == POType.STANDARD && _receiptInvoiceID == 0) { XtraMessageBox.Show("Invoice value can't be be greater than Order value", "Invalid Value", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } invoice.WayBillNo = txtWayBill.Text; invoice.TransitTransferNo = txtTransitNumber.Text; invoice.STVOrInvoiceNo = txtInvoiceNumber.Text; invoice.POID = _orderID; invoice.SavedByUserID = CurrentContext.UserId; invoice.AirFreight = Convert.ToDouble(txtInvoiceAirFreight.EditValue); invoice.SeaFreight = Convert.ToDouble(txtInvoiceSeaFreight.EditValue); invoice.InlandFreight = Convert.ToDouble(txtInvoiceInlandFreight.EditValue); invoice.CustomDutyTax = Convert.ToDouble(txtInvoiceCustomDutyTax.EditValue); invoice.CBE = Convert.ToDouble(txtInvoiceCBEServiceCharge.EditValue); invoice.InvoiceTypeID = Convert.ToInt32(lkInvoiceType.EditValue); invoice.DateOfEntry = Convert.ToDateTime(dtInvoiceDate.EditValue); invoice.ExchangeRate = Convert.ToDouble(txtExchangeRate.EditValue); invoice.LCID = Convert.ToInt32(lkCurrencyLCID.EditValue); invoice.ActivityID = po.StoreID; invoice.Rowguid = Guid.NewGuid(); invoice.PrintedDate = dtInvoiceDate.DateTime; invoice.IsVoided = false; invoice.ShippingSite = " "; invoice.IsConvertedFromDeliveryNote = false; invoice.IsDeliveryNote = Convert.ToInt32(lkDocumentType.EditValue) == DocumentType.CONSTANTS.DLVN; if (Convert.ToInt32(lkDocumentType.EditValue) != -1) { invoice.DocumentTypeID = Convert.ToInt32(lkDocumentType.EditValue); } invoice.Save(); this.LogActivity("Save-Invoice", invoice.ID); lblInvoiceNoDetail.Text = txtInvoiceNumber.EditValue.ToString(); lblInvoiceTypeDetail.Text = lkInvoiceType.Text; BLL.Receipt receipt = new BLL.Receipt(); receipt.UpdateInvoiceRelatedHeaders(invoice); _receiptInvoiceID = invoice.ID; MessageBox.Show("Invoice saved!", "Confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information); HeaderGroupDetail.Text = "Invoice No: " + txtInvoiceNumber.EditValue.ToString(); } }
public static bool IsInvoiceElectronic(string invoiceNo) { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectIsInvoiceElectronic(invoiceNo); invoice.LoadFromRawSql(query); if (invoice.RowCount == 0) return false; return (bool)invoice.GetColumn("IsElectronic"); }
/// <summary> /// Commits the account to account transfer. /// </summary> /// <param name="orderID">The order ID.</param> /// <param name="userID">The user ID.</param> /// <param name="convertedEthDate">The converted eth date.</param> public void CommitAccountToAccountTransfer(int orderID, int userID, DateTime convertedEthDate) { int?supplierID = null; BLL.Transfer transfer = new Transfer(); transfer.LoadByOrderID(orderID); if (transfer.RowCount == 0) { return; } int newStoreID, newPhysicalStoreID; newStoreID = transfer.ToStoreID; newPhysicalStoreID = transfer.ToPhysicalStoreID; PhysicalStore toPhysicalStore = new PhysicalStore(); toPhysicalStore.LoadByPrimaryKey(transfer.ToPhysicalStoreID); BLL.PickList picklist = new PickList(); picklist.LoadByOrderID(orderID); BLL.PickListDetail pld = new PickListDetail(); pld.LoadByPickListIDWithStvlogID(picklist.ID); BLL.ReceiveDoc rdOriginal = new ReceiveDoc(); rdOriginal.LoadByPrimaryKey(pld.ReceiveDocID); BLL.Order order = new Order(); order.LoadByPrimaryKey(orderID); if (order.OrderTypeID == OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER) { var activity = new Activity(); activity.LoadByPrimaryKey(newStoreID); supplierID = activity.SupplierID; } else if (order.OrderTypeID == OrderType.CONSTANTS.STORE_TO_STORE_TRANSFER) { var activity = new Activity(); activity.LoadByPrimaryKey(newPhysicalStoreID); supplierID = activity.SupplierID; } PO po = PO.CreatePOforStandard((int)order.GetColumn("OrderTypeID"), transfer.ToStoreID, supplierID, "Transfer", CurrentContext.LoggedInUser.ID); int IDPrinted = Convert.ToInt32(pld.GetColumn("IDPrinted")); int receiptTypeID = order.OrderTypeID == OrderType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER ? ReceiptType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER :order.OrderTypeID == OrderType.CONSTANTS.STORE_TO_STORE_TRANSFER ? ReceiptType.CONSTANTS.STORE_TO_STORE_TRANSFER : order.OrderTypeID == OrderType.CONSTANTS.ERROR_CORRECTION_TRANSFER ? ReceiptType.CONSTANTS.ERROR_CORRECTION:ReceiptType.CONSTANTS.STANDARD_RECEIPT; Receipt receipt = ReceiptInvoice.CreateReceiptInvoiceAndReceiptForTransfer(receiptTypeID, po.ID, toPhysicalStore.PhysicalStoreTypeID, IDPrinted, userID); var mergedPickLists = MergePickListsOfSameInfo(pld); // Picklists of the same info means: Based on all constraints we have on receiveDoc(Batch,Exp,ItemID,UnitID...): should be merged with summed quantity. pld.Rewind(); while (!pld.EOF) { if (IDPrinted != Convert.ToInt32(pld.GetColumn("IDPrinted"))) { IDPrinted = Convert.ToInt32(pld.GetColumn("IDPrinted")); receipt = ReceiptInvoice.CreateReceiptInvoiceAndReceiptForTransfer(receiptTypeID, po.ID, toPhysicalStore.PhysicalStoreTypeID, IDPrinted, userID); } var rDoc = new ReceiveDoc(); if (!mergedPickLists.ContainsKey(pld.ID)) { pld.MoveNext(); continue; } rDoc.SaveNewReceiveDocEntryFromPicklistDetail(pld, userID, newStoreID, newPhysicalStoreID, convertedEthDate, receipt.ID, supplierID); pld.MoveNext(); } }
public void LoadByReceiptID(int receiptID) { BLL.Receipt rct = new Receipt(); rct.LoadByPrimaryKey(receiptID); BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.LoadByPrimaryKey(rct.ReceiptInvoiceID); this.LoadByPrimaryKey(rctInvoice.POID); }
private void lblWaybill_MouseEnter(object sender, EventArgs e) { if (lkReceiptInvoice.EditValue != null) { var receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey((int)lkReceiptInvoice.EditValue); ShowTooltip(receiptInvoice.PrintedDate.ToString()); } }
public static Receipt CreateAutomaticReceiptInvoiceForSTVTransfer(int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.IsDeliveryNote = false; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(BLL.ReceiptType.CONSTANTS.STANDARD_RECEIPT, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return receipt; }
private void LoadItemsFromTransferredReceiptInvoiceDetail(int receiptInvoiceID) { BLL.ReceiptInvoice receiptInvoice = new ReceiptInvoice(); receiptInvoice.LoadByPrimaryKey(receiptInvoiceID); if (receiptInvoice.RowCount == 0) { XtraMessageBox.Show("Invalid STV/Invoice number!", "Error"); return; } DataTable tbl = BLL.Item.GetItemsByReceiptInvoiceNoForSTVTransfer(receiptInvoice.ID); _dtSelectedTable = tbl.Clone(); gridSelected.DataSource = _dtSelectedTable; foreach (DataRow dr in tbl.Rows) { SelectAnItem(dr); } }
public static Receipt CreateReceiptInvoiceAndReceiptForTransfer(int receiptTypeID, int POID, int warehouseID, int IDPrinted, int userID) { BLL.ReceiptInvoice rctInvoice = new ReceiptInvoice(); rctInvoice.AddNew(); var po = new BLL.PO(); po.LoadByPrimaryKey(POID); var activityID = po.StoreID; //Enter Invoice Related Information //We should Save the STV Number Here rctInvoice.POID = POID; rctInvoice.STVOrInvoiceNo = IDPrinted.ToString("00000"); rctInvoice.ExchangeRate = 1; rctInvoice.Insurance = 0; rctInvoice.DateOfEntry = DateTimeHelper.ServerDateTime; rctInvoice.SavedByUserID = userID; rctInvoice.ActivityID = activityID; rctInvoice.IsDeliveryNote = false; rctInvoice.InvoiceTypeID = BLL.InvoiceType.InternalSTV; rctInvoice.PrintedDate = DateTimeHelper.ServerDateTime; rctInvoice.Rowguid = Guid.NewGuid(); rctInvoice.IsVoided = false; rctInvoice.ShippingSite = " "; rctInvoice.IsConvertedFromDeliveryNote = false; rctInvoice.DocumentTypeID = DocumentType.CONSTANTS.STV; rctInvoice.Save(); //Save the receipt BLL.Receipt receipt = new Receipt(); int receiptID = receipt.AddNewReceipt(receiptTypeID, warehouseID, userID, rctInvoice.ID, null, ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED); receipt.LoadByPrimaryKey(receiptID); return receipt; }
private void btnSearch_Click(object sender, EventArgs e) { BLL.ReceiptInvoice rI = new ReceiptInvoice(); rI.GetStatusOfInvoice(txtInvoiceNo.Text); grdInvoiceSearchDetails.DataSource = rI.DefaultView; }
/// <summary> /// It will return all Invoice For Now /// </summary> /// <returns></returns> public static DataView GetIncompleteInvoices(int userID, int poTypeID, int documentTypeID) { SoftwareSettings softwareSetting = new SoftwareSettings(); ReceiptInvoice Invoice = new ReceiptInvoice(); var settingDT = softwareSetting.GetValue("IsElectronicReceiveOnly"); bool isNonElectronicReceiveOnly = true; if (settingDT.Rows.Count != 0) { isNonElectronicReceiveOnly = bool.Parse(settingDT.Rows[0].Field<string>("Value").ToLower()); } var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetIncompleteInvoices(userID, isNonElectronicReceiveOnly,poTypeID,documentTypeID); Invoice.LoadFromRawSql(query); return Invoice.DefaultView; }
private void gridInvoiceDetailView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e != null && e.Column.FieldName == "InvoiceCost") { DataRow drv = gridInvoiceDetailView.GetFocusedDataRow(); // receipt.SaveFOBForEachReceiveDoc(); var receipt = new BLL.Receipt(Convert.ToInt32(drv["ReceiptID"])); var receiptInvoice = new ReceiptInvoice(receipt.ReceiptInvoiceID); var po = new BLL.PO(receiptInvoice.POID); if (po.IsElectronic) { var originalInvoiceCost = Convert.ToDecimal(drv["OriginalInvoiceCost"]); var newInvoiceCost = Convert.ToDecimal(drv["InvoiceCost"]); if (newInvoiceCost != originalInvoiceCost) { drv["InvoiceCost"] = originalInvoiceCost; XtraMessageBox.Show("You are trying to change the Invoice Cost set by Center. Please enter the correct cost!","Invoice Cost Not Similar",MessageBoxButtons.OK,MessageBoxIcon.Warning); } } else if (drv["InvoiceCost"] != DBNull.Value) { PricePerPackPage PricingForm = new PricePerPackPage(ReceiptID, Convert.ToInt32(drv["ItemID"]), Convert.ToInt32(drv["ItemUnitID"]), Convert.ToInt32(drv["ManufacturerID"]), Convert.ToInt32(drv["ActivityID"]), Convert.ToDouble(drv["InvoiceCost"])); PricingForm.ShowDialog(this); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); } } else if (e != null && e.Column.FieldName == "Margin") { DataRow drv = gridInvoiceDetailView.GetFocusedDataRow(); // receipt.SaveFOBForEachReceiveDoc(); var receipt = new BLL.Receipt(Convert.ToInt32(drv["ReceiptID"])); var receiptInvoice = new ReceiptInvoice(receipt.ReceiptInvoiceID); var po = new BLL.PO(receiptInvoice.POID); var item = new Item(); item.LoadByPrimaryKey(Convert.ToInt32(drv["ItemID"])); if (po.IsElectronic && !item.IsVariableMargin) { var originalMargin = Convert.ToDecimal(drv["OriginalMargin"]); var newMargin = Convert.ToDecimal(drv["Margin"]); if (newMargin != originalMargin) { drv["Margin"] = originalMargin; XtraMessageBox.Show("You are trying to change the Margin set by Center. Please enter the correct Margin!", "Margin Not Similar", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (drv["Margin"] != DBNull.Value) { MarginPage MarginForm = new MarginPage(ReceiptID, Convert.ToInt32(drv["ItemID"]), Convert.ToInt32(drv["ItemUnitID"]), Convert.ToInt32(drv["ManufacturerID"]), Convert.ToInt32(drv["ActivityID"]), Convert.ToDouble(drv["Margin"])); MarginForm.ShowDialog(this); LoadSelectedGRVDetailForInvoiceEntry(ReceiptID); } } }
public static DataView GetIncompleteInvoicesForCenter(int userID, bool isDeliveryNote) { var invoice = new ReceiptInvoice(); if (BLL.Settings.IsCenter) // If Center, Get incomplete invoices including those with FOB = 0 { var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetIncompleteInvoicesForCenter(userID, isDeliveryNote); invoice.LoadFromRawSql(query); } return invoice.DefaultView; }
public void LoadCostBuilUp(bool AutoProrate,string GRNFString) { //ToDo: Remove the Setting Before Implementation _CostBuildup = new CostBuildup(); ReceiptInvoice invoice = new ReceiptInvoice(); invoice.LoadByPrimaryKey(GRV.ReceiptInvoiceID); _CostBuildup.UseTransitServiceCharge = false; _CostBuildup.AutoProrate = AutoProrate; _CostBuildup.LoadByReceiptIDInvoiceIDAndPoID(ReceiptID, invoice.ID, invoice.POID, GRNFString,_SubTotal); }
public static decimal GetInvoiceQuantity(string invoiceNo, string itemId, string unitId, string manufacturerId) { ReceiptInvoice invoice = new ReceiptInvoice(); var query = HCMIS.Repository.Queries.ReceiptInvoice.SelectGetInvoiceQuantity(invoiceNo, itemId, unitId, manufacturerId); invoice.LoadFromRawSql(query); if (invoice.RowCount == 0) return 0; return (decimal)invoice.GetColumn("Quantity"); }
private void btnSave_Click(object sender, EventArgs e) { int warehouseID = Convert.ToInt32(lkWarehouse.EditValue); receiveDoc.Rewind(); var po = new BLL.PO(); var receiptInvoice = new BLL.ReceiptInvoice(); while (!receiveDoc.EOF) { //Handle the PO. //int receiptID; if (po.RowCount == 0 || po.StoreID != receiveDoc.StoreID) { Supplier supplier = new Supplier(); po = BLL.PO.CreatePOforStandard(OrderType.CONSTANTS.STANDARD_ORDER, receiveDoc.StoreID, supplier.GetHubHomeOfficeSupplierID(), "",CurrentContext.LoggedInUser.ID); //Should we receive it as hub to hub transfer? We're now using Standard order. receipt = BLL.ReceiptInvoice.CreateAutomaticReceiptInvoiceForSTVTransfer(po.ID, warehouseID, STVNo, CurrentContext.UserId); } receiveDoc.Quantity = receiveDoc.QtyPerPack * receiveDoc.NoOfPack; receiveDoc.ReceiptID = receipt.ID; receiveDoc.MoveNext(); } receiveDoc.Save(); //Save the location receiveDoc.Rewind(); BLL.ReceivePallet receivePallet = new ReceivePallet(); while (!receiveDoc.EOF) { //Save Location Information BLL.PalletLocation palletLocation = new PalletLocation(); receivePallet.AddNew(); int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID")); receivePallet.PalletLocationID = palletLocationID; palletLocation.LoadByPrimaryKey(palletLocationID); receivePallet.PalletID = palletLocation.PalletID; receivePallet.ReceivedQuantity = receiveDoc.Quantity; receivePallet.Balance = receiveDoc.Quantity; receivePallet.ReceiveID = receiveDoc.ID; receivePallet.ReservedStock = 0; //Save Discrepancy information if there is any receiveDocShortage.Rewind(); while (receiveDocShortage.FindNextByGUID(receiveDoc.GetColumn("GUID").ToString())) { receiveDocShortage.ReceiveDocID = receiveDoc.ID; if (receiveDocShortage.ShortageReasonID == ShortageReasons.Constants.DAMAGED) { receiveDoc.NoOfPack += receiveDocShortage.NoOfPacks; receiveDoc.Quantity += receiveDocShortage.NoOfPacks*receiveDoc.QtyPerPack; palletLocationID = Convert.ToInt32(receiveDocShortage.GetColumn("PalletLocationID")); receivePallet.AddNew(); receivePallet.PalletLocationID = palletLocationID; palletLocation.LoadByPrimaryKey(palletLocationID); receivePallet.PalletID = palletLocation.PalletID; receivePallet.ReceivedQuantity = receiveDocShortage.NoOfPacks*receiveDoc.QtyPerPack; receivePallet.Balance = receiveDocShortage.NoOfPacks*receiveDoc.QtyPerPack; receivePallet.ReceiveID = receiveDoc.ID; receivePallet.ReservedStock = 0; } } receiveDoc.MoveNext(); } receivePallet.IsOriginalReceive = true; receivePallet.Save(); }
public void LoadByReceiptIDInvoiceIDAndPoID(int ReceiptID, int InvoiceID, int PoID, string GRNString, double GRVTotalValue) { purchaseOrder = new PO(); Invoice = new ReceiptInvoice(); GRV = new Receipt(); //Load this.GRVTotal = GRVTotalValue; LoadData(ReceiptID, InvoiceID, PoID); _activity = new Activity(); _activity.LoadByPrimaryKey(Invoice.ActivityID); Supplier = purchaseOrder.Supplier.CompanyName; OrderNo = purchaseOrder.PONumber; InvoiceNo = Invoice.STVOrInvoiceNo; GRVNo = GRNString; AWBNo = Invoice.WayBillNo; ShippedBy = Invoice.ShippedBy; if (Invoice.IsColumnNull("InvoiceTypeID") || GRV.ReceiptTypeID == ReceiptType.CONSTANTS.STOCK_RETURN) { AutoProrate = false; purchaseOrder.ExhangeRate = FOBExchangeRate = 1; } else if (Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.NON_STANDARD) { AutoProrate = false; purchaseOrder.ExhangeRate = FOBExchangeRate = 1; } else { if (purchaseOrder.PurchaseType == POType.COST_AND_EST_FREIGHT) { ProrateUsingFreightOnPO = true; ProrateUsingFreightOnInvoice = true; UsePOFreight = true; } else if (purchaseOrder.PurchaseType == POType.COST_AND_FREIGHT) { ProrateUsingFreightOnPO = true; ProrateUsingFreightOnInvoice = true; UsePOFreight = false; } } if (!_activity.IsHealthProgram()) { UseCustomDutyTax = true; } if (AutoProrate && Invoice.InvoiceTypeID != -255 && Invoice.InvoiceTypeID != InvoiceType.Internal) { Prorate(); } if (Invoice.IsColumnNull("InvoiceTypeID") || Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE || Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.CIP || Invoice.InvoiceTypeID == ReceiptInvoiceType.InvoiceType.NON_STANDARD || _activity.IsHealthProgram()) { UseProvison = false; } else { UseProvison = true; } CalculateCostCoefficient(); PopulateDataTable(); }