private void btnReturn_Click(object sender, EventArgs e) { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); if (gridGRVs.DataSource == null) return; transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmGRNFPrinted(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change"); transaction.CommitTransaction(); this.LogActivity("Return-For-Costing", ReceiptID); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); } catch (Exception exp) { transaction.RollbackTransaction(); throw exp; } PutAwayListsLoad(null, null); }
private void btnChangeReceiptConfirmationStatus_Click(object sender, EventArgs e) { int newReceiptConfirmationStatus = int.Parse(lkReceiptConfirmationStatus.EditValue.ToString()); BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadByReceiptID(int.Parse(txtReceiptID.Text)); while (!rd.EOF) { ReceiveDocConfirmation rdc = new ReceiveDocConfirmation(); rdc.LoadByReceiveDocID(rd.ID); rdc.ReceiptConfirmationStatusID = newReceiptConfirmationStatus; rdc.Save(); rd.MoveNext(); } XtraMessageBox.Show("Successful!"); }
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()); }
private void btnCancelReceive_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to Cancel the Receipt Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { try { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(receiptID); receiveDoc.Rewind(); while (!receiveDoc.EOF) { BLL.ReceiveDoc.DeleteAReceiveDocEntry(receiveDoc.ID, CurrentContext.UserId); receiveDoc.MoveNext(); } XtraMessageBox.Show("You have successfully canceled the draft receipt.", "Confirmation"); BindFormContents(); } catch (Exception exception) { XtraMessageBox.Show(exception.Message); } } }
private void ReturnFromGRVPrinting() { int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); receiveDoc.ConfirmGRNFPrinted(null); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Return For Price Change"); BindFormContents(); this.LogActivity("Return-SRM-To-Costing", ReceiptID); }
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()); }
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; }
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 HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout PrintReceiptConfirmationForShortage(string reference, int printedID) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout(); ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(ReceiptID); rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, true, 2, printedID,null,FiscalYear.Current); printout.DataSource = rc.DefaultView.ToTable(); return printout; }
private void btnPrint_Click(object sender, EventArgs e) { DataRow dataRow = gridReceiveView.GetFocusedDataRow(); if (dataRow != null) { if (Convert.ToInt32(dataRow["ReceiptConfirmationStatusID"]) == ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED) { ReceiptID = Convert.ToInt32(dataRow["ReceiptID"]); PrintDialog printDialog = new PrintDialog(); printDialog.PrinterSettings.Copies = BLL.Settings.GRNFCopies; DialogResult dialogResult = printDialog.ShowDialog(); if (dialogResult != DialogResult.OK) { MessageBox.Show("Printing Canceled by user", "Cancel Printint...", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr(); XtraReport printout; try { transaction.BeginTransaction(); printout = WorkflowReportFactory.CreateGRNFPrintout(ReceiptID, null, false, FiscalYear.Current); var receipt = new BLL.Receipt(ReceiptID); var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (receipt.ReceiptInvoice.PO.PurchaseType == BLL.POType.STORE_TO_STORE_TRANSFER || !BLL.Settings.HandleGRV) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Transfer Confirmed"); } else { recDoc.ConfirmGRNFPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRNF Printed"); } transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); throw; } for (int i = 0; i < printDialog.PrinterSettings.Copies; i++) { printout.Print( printDialog.PrinterSettings.PrinterName); } ReceiptConfirmation_Load(null, null); } else { XtraMessageBox.Show("The selected receipt has to be confirmed before GRNF is printed!", "ERROR", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); } } }
private void btnSave_Click(object sender, EventArgs e) { BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); if (PONumber.StartsWith("S2S-")) { if (SetFinalCost()) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Store To Store Confirmed"); } } else { recDoc.ConfirmPrice(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Confirmed"); } this.LogActivity("Confirm-Price", ReceiptID); XtraMessageBox.Show("Received Cost and Margin Set successfully!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); PutAwayListsLoad(null, null); }
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(); }
private void ConfirmQuantityAndLocation() { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); DataRow dr = gridReceiveView.GetFocusedDataRow(); if (dr == null) { throw new Exception("Nothing to confirm!"); } int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptIDWithReceivePallet(ReceiptID); while (!receiveDoc.EOF) { int palletLocationID = Convert.ToInt32(receiveDoc.GetColumn("PalletLocationID")); pl.LoadByPrimaryKey(palletLocationID); pl.Confirmed = true; pl.Save(); receiveDoc.MoveNext(); } BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.ConfirmQuantityAndLocation(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Receive Confirmed"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Confirmed!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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 btnCancelReceive_Click(object sender, EventArgs e) { if (XtraMessageBox.Show(DevExpress.LookAndFeel.UserLookAndFeel.Default, "Are you sure, you want to Cancel the Receipt Document?", "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.Yes) { try { int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString()); var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(receiptID); receiveDoc.Rewind(); while (!receiveDoc.EOF) { BLL.ReceiveDoc.DeleteAReceiveDocEntry(receiveDoc.ID, CurrentContext.UserId); receiveDoc.MoveNext(); } XtraMessageBox.Show("You have successfully canceled the draft receipt.", "Confirmation"); BindFormContents(); } catch (Exception exception) { XtraMessageBox.Show(exception.Message); } } }
public static bool AreThereIssues(int receiptID) { BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadByReceiptID(receiptID); return(rd.AreThereIssues); }
private void ReturnToStoreForQuantityEdit() { //TODO: finish updating the changed locations MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); transaction.BeginTransaction(); try { PalletLocation pl = new PalletLocation(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); if (gridDetailView.DataSource == null) return; BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); recDoc.SetStatusAsDraft(CurrentContext.UserId); BLL.Receipt receiptStatus = new BLL.Receipt(); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "Returned To Draft"); transaction.CommitTransaction(); XtraMessageBox.Show("Receipt Returned!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); BindFormContents(); } catch (Exception exp) { transaction.RollbackTransaction(); XtraMessageBox.Show(exp.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnSave_Click(object sender, EventArgs e) { GRV.SaveInsurance(); GRV.SaveCostCoefficientAndTotalValue(CurrentContext.UserId); //ToDo: Remove this When it is safe and Ready for deployement. GRV.RecordAverageCostAndSellingPrice(CurrentContext.UserId); print(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(ReceiptID); BLL.Receipt receiptStatus = new BLL.Receipt(); if (!BLL.Settings.UseReceiveCostConfirmation && PONumber.StartsWith("S2S-")) { if (SetFinalCost()) { recDoc.ConfirmGRVPrinted(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "StoreToStore Confirmed"); } } else if (BLL.Settings.UseReceiveCostConfirmation) { recDoc.SetPrice(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CALCULATED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } else { recDoc.ConfirmPrice(CurrentContext.UserId); receiptStatus.LoadByPrimaryKey(ReceiptID); receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } XtraMessageBox.Show("Received Cost and Margin Set successfully!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); PutAwayListsLoad(null, null); this.LogActivity("Print-Cost-Analysis", ReceiptID); }
private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) { // Bind the detail grid var pl = new PalletLocation(); ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); try { //B1A data var SelectGRV = gridReceiveView.GetFocusedDataRow(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); lblGRVNo.Text = reference; lblMode.Text = (string)SelectGRV["ModeName"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblPoNumber.Text = (string)SelectGRV["PONo"]; lblCluster.Text = (string)SelectGRV["ClusterName"]; lblWarehouse.Text = (string)SelectGRV["WarehouseName"]; lblStore.Text = (string)SelectGRV["PhysicalStoreName"]; lblType.Text = (string)SelectGRV["ReceiptType"]; lblStatus.Text = (string)SelectGRV["ReceiptStatus"]; var logReceiptStatus = new LogReceiptStatus(); var dtHistory = logReceiptStatus.GetLogHistory(ReceiptID, "PRC"); if (dtHistory != null && dtHistory.Count > 0) { lblCalculatedBy.Text = (string)dtHistory[0]["FullName"]; lblCalculatedDate.Text = ((DateTime)dtHistory[0]["Date"]).ToShortDateString(); } else { lblCalculatedDate.Text = lblCalculatedBy.Text = "-"; } var receiveDoc = new ReceiveDoc(); receiveDoc.LoadByReceiptID(Convert.ToInt32(SelectGRV["ReceiptID"])); lblConfirmedDate.Text = receiveDoc.ConfirmedDateTime.ToString() != "" ? receiveDoc.ConfirmedDateTime.ToShortDateString() : "-"; lblConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-"; lblGRVNumber.Text = reference; lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString(); // lblConfirmedDate.Text =SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-"; ds = new DataSet(); DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID); dvMaster.TableName = "Master"; ds.Tables.Add(dvMaster); gridDetails.DataSource = ds.Tables[dvMaster.TableName]; int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]); try { StoreID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["StoreID"]); } catch { } var receipt = new BLL.Receipt(); receipt.LoadByPrimaryKey(ReceiptID); int receiptTypeID = receipt.ReceiptTypeID; } catch { gridDetails.DataSource = null; } //reset btnCancelVoidRequest.Enabled = true; btnVoidRequest.Enabled = true; btnVoid.Enabled = true; btnReprintGRV.Enabled = true; if (Convert.ToBoolean(gridReceiveView.GetFocusedDataRow()["isreprint"].ToString())) { btnReprintGRV.Enabled = false; } if (Convert.ToBoolean(gridReceiveView.GetFocusedDataRow()["hasreprint"].ToString())) { btnCancelVoidRequest.Enabled = false; btnVoidRequest.Enabled = false; btnVoid.Enabled = false; } }
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(); }
private void btnReturn_Click(object sender, EventArgs e) { var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(receipt.ID); recDoc.ConfirmGRNFPrinted(CurrentContext.UserId); receipt.ChangeStatus(ReceiptConfirmationStatus.Constants.GRNF_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); MessageBox.Show("The Correction has been return to Pricing", "Success",MessageBoxButtons.OK,MessageBoxIcon.Information); }
private void PrintReceiptConfirmation(string referenceNumber, int? reprintOfReceiptConfirmationPrintoutID) { ReceiptConfirmationPrintout rc = new ReceiptConfirmationPrintout(); HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName); HCMIS.Desktop.Reports.SRMPrintout srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(CurrentContext.LoggedInUserName); int ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); BLL.ReceiveDoc receiveDoc = new ReceiveDoc(); // receiveDoc.LoadByReferenceNo(reference); receiveDoc.LoadByReceiptID(ReceiptID); BLL.Supplier supplier = new Supplier(); supplier.LoadByPrimaryKey(receiveDoc.SupplierID); int printedID = 0; int GRNFNo = BLL.ReceiptConfirmationPrintout.GetGRNFNo(ReceiptID); if (currentMode == Modes.DeliveryNotePrinting) { printout.BranchName.Text = GeneralInfo.Current.HospitalName; printout.xrGRVLabel.Text = "Delivery Note."; 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.Visible = false; printout.xrInvoiceNoValue.Visible = false; printout.xrPurchaseOrderNo.Visible = false; printout.xrPurchaseOrderNoValue.Visible = false; printout.xrSTV.Visible = false; printout.xrSTVNoValue.Visible = false; printout.DataSource = rc.PrepareDataForPrintout(ReceiptID, CurrentContext.UserId, false, 5, null, reprintOfReceiptConfirmationPrintoutID,FiscalYear.Current); CalendarLib.DateTimePickerEx dtDate = new CalendarLib.DateTimePickerEx(); //dtDate.CustomFormat = "dd/MM/yyyy"; dtDate.Value = receiveDoc.EurDate; printout.Date.Text = dtDate.Text; } var activity = new Activity(); activity.LoadByPrimaryKey(receiveDoc.StoreID); printout.xrLabelStoreName.Text = activity.FullActivityName; if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID)) { HCMIS.Desktop.Reports.ReceiptConfirmationShortagePrintout printoutShortage = PrintReceiptConfirmationForShortage(referenceNumber, printedID); printout.xrShortageReport.ReportSource = printoutShortage; printout.PrintingSystem.ContinuousPageNumbering = true; } else { printout.ReportFooter.Visible = false; } //Successfully printed //Release Product CostCalculator GRV = new CostCalculator(); GRV.LoadGRV(ReceiptID); GRV.ReleaseForIssue(); String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString(); BLL.ReceiveDoc recDoc = new ReceiveDoc(); recDoc.LoadByReferenceNo(reference); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); BindFormContents(); }
private void btnConfirm_Click(object sender, EventArgs e) { MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr(); var dt = grdDetailView.DataSource as DataView; if ((dt) != null) { // This is where we set the Price foreach (DataRow dr in dt.Table.Rows) { var costElement = new CostElement(); costElement.LoadFromDataRow(dr, receipt.ID); costElement.AverageCost = Convert.ToDouble(dr["AverageCost"]); costElement.Margin = Convert.ToDouble(dr["Margin"]); costElement.SellingPrice = Convert.ToDouble(dr["SellingPrice"]); try { transaction.BeginTransaction(); var journalService = new JournalService(); journalService.StartRecordingSession(); costElement.ConfirmPrice(CurrentContext.UserId, "", journalService, ChangeMode.PriceOverride); var receiveDoc = new ReceiveDoc(); receiveDoc.SavePrice(costElement, CurrentContext.UserId); journalService.CommitRecordingSession(); transaction.CommitTransaction(); } catch (Exception exception) { transaction.RollbackTransaction(); XtraMessageBox.Show("Error : " + exception.Message, "Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); throw exception; } var report = new PriceOverridePrintout { xrCostedBy = {Text = CurrentContext.LoggedInUserName}, lblDate = {Text = DateTimeHelper.ServerDateTime.ToString()}, DataSource = getPriceChangeReport(costElement) }; report.ShowPreviewDialog(); } var recDoc = new ReceiveDoc(); recDoc.LoadByReceiptID(receipt.ID); recDoc.ConfirmGRVPrinted(CurrentContext.UserId); receipt.ChangeStatus(ReceiptConfirmationStatus.Constants.GRV_PRINTED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Price Set"); } }
private void gridReceiveView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { // Bind the detail grid PalletLocation pl = new PalletLocation(); try { ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); BLL.Receipt receiptDoc = new BLL.Receipt(); var rd = new ReceiveDoc(); rd.LoadByReceiptID(ReceiptID); var ps = new PhysicalStore(); ps.LoadByPrimaryKey(rd.PhysicalStoreID); var w = new BLL.Warehouse(); w.LoadByPrimaryKey(ps.PhysicalStoreTypeID); lblWarehouse.Text = w.Name ?? "-"; var c = new Cluster(); c.LoadByPrimaryKey(w.ClusterID); lblCluster.Text = c.Name ?? "-"; receiptDoc.LoadByPrimaryKey(ReceiptID); DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF(); gridDetails.DataSource = GRNFDetail; gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF(); int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]); var SelectGRV = gridReceiveView.GetFocusedDataRow(); lblMode.Text = (string)SelectGRV["ModeName"]; lblAccount.Text = (string)SelectGRV["AccountName"]; lblSubAccount.Text = (string)SelectGRV["SubAccountName"]; lblActivity.Text = (string)SelectGRV["ActivityName"]; lblSupplier.Text = (string)SelectGRV["SupplierName"]; lblPONumber.Text = (string)SelectGRV["PONo"]; lblType.Text = (string)SelectGRV["ReceiptType"]; lblStatus.Text = (string)SelectGRV["CurrentStatus"]; var lgs = new LogReceiptStatus(); lgs.LoadByReceiptID(ReceiptID); lblCalculatedDate.Text = lgs.StatusChangedDate.ToShortDateString(); var user = new User(); if (SelectGRV["calculatedBy"] != DBNull.Value) { user.LoadByPrimaryKey(Convert.ToInt32(SelectGRV["calculatedBy"])); lblCalculatedBy.Text = user.FullName; } else { lblCalculatedBy.Text = "-"; } lblCostConfirmedBy.Text = SelectGRV["confirmedBy"] != DBNull.Value ? SelectGRV["confirmedBy"].ToString() : "-"; //lblGRVNumber.Text = reference; //lblRecivedDate.Text = ((DateTime)SelectGRV["Date"]).ToShortDateString(); lblCostConfirmedDate.Text = SelectGRV["confirmedDate"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["confirmedDate"]).ToShortDateString() : "-"; string s = ""; int length = ((string)SelectGRV["STVOrInvoiceNo"]).Length; string grv = (Convert.ToInt32(SelectGRV["IDPrinted"])).ToString(); HeaderGroup.Text = "Invoice No: " + (string)SelectGRV["STVOrInvoiceNo"] + s.PadRight(240 - length) + "GRV No: " + grv ; //ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]); //ds = new DataSet(); //DataTable dvMaster = pl.GetDetailsOfByReceiptID(ReceiptID); //dvMaster.TableName = "Master"; //ds.Tables.Add(dvMaster); //gridDetails.DataSource = ds.Tables[dvMaster.TableName]; //var receipt = new BLL.Receipt(); //receipt.LoadByPrimaryKey(ReceiptID); //int receiptTypeID = receipt.ReceiptTypeID; if (currentMode == Modes.GRVPrinting) { if (status != ReceiptConfirmationStatus.Constants.PRICE_CONFIRMED) { gridDetails.Enabled = false; btnConfirm.Enabled = false; btnPrint.Enabled = false; btnReturn.Enabled = false; } else { gridDetails.Enabled = true; btnConfirm.Enabled = true; btnPrint.Enabled = true; btnReturn.Enabled = true; } } } catch { gridDetails.DataSource = null; gridShortage.DataSource = null; } }
public static bool AreThereIssues(int receiptID) { BLL.ReceiveDoc rd = new ReceiveDoc(); rd.LoadByReceiptID(receiptID); return rd.AreThereIssues; }