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);
        }
        internal void SetStatusConfirmQuantityAndLocation(int receiveID, int? userID)
        {
            LoadByReceiveDocID(receiveID);
            BLL.ReceiveDoc rcDoc=new ReceiveDoc();
            BLL.Receipt rct = new Receipt();
            rcDoc.LoadByPrimaryKey(receiveID);
            rct.LoadByPrimaryKey(rcDoc.ReceiptID);
            if (RowCount == 0)
            {
                AddNew();
                ReceiveDocID = receiveID;
            }

            if(userID.HasValue)
            {

               ReceiptQuantityConfirmedByUserID = userID.Value;
            }

                ReceiptConfirmationStatusID = rct.ReceiptTypeID == BLL.ReceiptType.CONSTANTS.BEGINNING_BALANCE?
                                                 ReceiptConfirmationStatus.Constants.GRV_PRINTED:
                                                    ReceiptConfirmationStatus.Constants.RECEIVE_QUANTITY_CONFIRMED;

            Save();
        }
 public void Select(int receiptID)
 {
     receipt = new BLL.Receipt();
     receipt.LoadByPrimaryKey(receiptID);
     btnSave.Enabled = receipt.ReceiptStatusID == ReceiptConfirmationStatus.Constants.GRNF_PRINTED &&
                       this.HasPermission("Save");
     btnConfirm.Enabled =btnReturn.Enabled = receipt.ReceiptStatusID == ReceiptConfirmationStatus.Constants.PRICE_CALCULATED &&
                          this.HasPermission("Confirmation");
     grdDetail.DataSource = receipt.GetGRVDetailsforCosting();
 }
 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);
 }
コード例 #5
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            var receipt = new BLL.Receipt();

            receipt.LoadByPrimaryKey(ReceiptID);
            var data         = BLL.PO.GetOrderSummary(receipt.ReceiptInvoiceID);
            var orderSummary = new OrderSummary {
                DataSource = data
            };

            orderSummary.ShowPreview();
        }
コード例 #6
0
        private void ReturnFromGRVPrinting()
        {
            BLL.ReceiveDoc receiveDoc = new ReceiveDoc();
            int            ReceiptID  = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);

            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();
        }
コード例 #7
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);
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
        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");
        }
コード例 #10
0
        //TODO: Definitly going to BLL but i don't have time to do a clean job here.

        #region Void Process

        private void btnVoid_Click(object sender, EventArgs e)
        {
            int receiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"].ToString());

            if (BLL.Receipt.AreThereIssues(receiptID))
            {
                XtraMessageBox.Show("There are issues with this GRV.  You can't void it.");
                return;
            }

            var grv = new ReceiptConfirmationPrintout();

            grv.Where.ReceiptID.Value = receiptID;
            grv.Query.Load();

            if (grv.IsColumnNull("VoidRequest") || !grv.VoidRequest)
            {
                XtraMessageBox.Show("Void needs to be first requested.", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                return;
            }

            if (
                XtraMessageBox.Show(UserLookAndFeel.Default, "Are you sure, you want to Void the Document?",
                                    "Are you sure:", MessageBoxButtons.YesNo, MessageBoxIcon.Information) ==
                DialogResult.Yes)
            {
                while (!grv.EOF)
                {
                    grv.IsVoided             = true;
                    grv.VoidApprovedByUserID = CurrentContext.UserId;
                    grv.VoidApprovalDateTime = DateTimeHelper.ServerDateTime;
                    grv.MoveNext();
                }

                grv.Save();
                ReturnToStoreForQuantityEdit();
                BLL.Receipt receiptStatus = new BLL.Receipt();
                receiptStatus.LoadByPrimaryKey(ReceiptID);
                receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.DRAFT_RECEIPT, null, this.GetFormIdentifier(), CurrentContext.UserId, "GRV Voided");

                this.LogActivity("Approve-Receipt-Void", ReceiptID);
            }
        }
コード例 #11
0
        private void print()
        {
            BLL.Receipt receipt   = new BLL.Receipt(ReceiptID);
            DataRow     dr        = gridGRVsView.GetFocusedDataRow();
            String      GRNString = dr["RefNo"].ToString();

            HCMIS.Desktop.Reports.CostAnalysisSubReport xReportCostAnalysis = new HCMIS.Desktop.Reports.CostAnalysisSubReport();
            xReportCostAnalysis.DataSource = GRV.CostAnalysis(GRNString);

            HCMIS.Desktop.Reports.CostBuildUp xReportCostBuildUp = new HCMIS.Desktop.Reports.CostBuildUp();
            xReportCostBuildUp.DataSource  = GRV.CostBuildUp.DataTable.DefaultView;
            xReportCostBuildUp.xrDate.Text = EthiopianDate.EthiopianDate.GregorianToEthiopian(BLL.DateTimeHelper.ServerDateTime);
            xReportCostBuildUp.xrSubreport1.ReportSource = xReportCostAnalysis;
            xReportCostBuildUp.xrCostedBy.Text           = CurrentContext.LoggedInUserName;
            xReportCostBuildUp.ShowPreviewDialog();
            MemoryStream stream = new MemoryStream();

            xReportCostBuildUp.ExportToPdf(stream);
            HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "CostAnalysis", true, ReceiptID, CurrentContext.UserId, BLL.DateTimeHelper.ServerDateTime);
        }
コード例 #12
0
        private static ReceiptConfirmationShortagePrintout PrintReceiptConfirmationForShortage(int receiptID, int printedID, FiscalYear fiscalYear)
        {
            var printout = new ReceiptConfirmationShortagePrintout();
            var rc       = new BLL.ReceiptConfirmationPrintout();

            var receiveDoc = new ReceiveDoc();
            var receipt    = new BLL.Receipt();

            receiveDoc.LoadByReceiptID(receiptID);
            receipt.LoadByPrimaryKey(receiptID);

            var referenceNumber = receiveDoc.RefNo;

            if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STANDARD_RECEIPT)
            {
                rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, true, 2, printedID, null, fiscalYear);
                printout.DataSource = rc.DefaultView.ToTable();
            }
            return(printout);
        }
コード例 #13
0
        private void print()
        {
            DataRow dr        = gridGRVsView.GetFocusedDataRow();
            String  GRNString = dr["RefNo"].ToString();

            BLL.Receipt receipt = new BLL.Receipt(ReceiptID);


            HCMIS.Desktop.Reports.PreviousCostPrintout xReportCostBuildUp =
                new HCMIS.Desktop.Reports.PreviousCostPrintout();
            xReportCostBuildUp.DataSource = BLL.Receipt.GetPreviousStockforCostAnalysisPrintout(ReceiptID);

            HCMIS.Desktop.Reports.CostAnalysisSubReport xReportCostAnalysis =
                new HCMIS.Desktop.Reports.CostAnalysisSubReport();
            xReportCostAnalysis.DataSource = GRV.CostAnalysis(GRNString);

            HCMIS.Desktop.Reports.CostCalculationPrintout xReportCostCalculationPrintOut =
                new HCMIS.Desktop.Reports.CostCalculationPrintout();
            xReportCostCalculationPrintOut.DataSource = GRV.GRVSoundDetail;

            HCMIS.Desktop.Reports.CostReport xReportCostReport = new HCMIS.Desktop.Reports.CostReport();
            xReportCostReport.DataSource       = receipt.CostAnalysis(GRNString);
            xReportCostReport.xrDate.Text      = EthiopianDate.EthiopianDate.GregorianToEthiopian(BLL.DateTimeHelper.ServerDateTime);
            xReportCostReport.xrCostedBy.Text  = CurrentContext.LoggedInUserName;
            xReportCostReport.xrWarehouse.Text = receipt.GetWarehouse();
            xReportCostReport.subReportCostCalculation.ReportSource = xReportCostCalculationPrintOut;
            xReportCostReport.xrSubreportCostBuildup.ReportSource   = xReportCostBuildUp;
            xReportCostReport.xrSubreportCostAnalysis.ReportSource  = xReportCostAnalysis;
            xReportCostReport.ShowPrintStatusDialog = true;
            xReportCostReport.CreateDocument();
            xReportCostReport.PrintingSystem.Document.AutoFitToPagesWidth = 1;
            xReportCostReport.ShowPreviewDialog();
            // LOG Cost Analysis printout in PDF Log
            MemoryStream stream = new MemoryStream();

            xReportCostReport.ExportToPdf(stream);
            HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "CostAnalysis", true, ReceiptID,
                                                                                CurrentContext.UserId,
                                                                                BLL.DateTimeHelper.ServerDateTime);
        }
コード例 #14
0
        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);
        }
コード例 #15
0
        private void PassReceiveForQtyConfirmation()
        {
            if (gridReceiveView.GetFocusedDataRow() != null)
            {
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();

                if (gridDetailView.DataSource == null)
                {
                    return;
                }

                BLL.ReceiveDoc recDoc = new ReceiveDoc();
                recDoc.LoadByReferenceNo(reference);
                recDoc.SetStatusAsReceived(CurrentContext.UserId);
                BLL.Receipt receiptStatus = new BLL.Receipt();
                receiptStatus.LoadByPrimaryKey(ReceiptID);
                receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null, this.GetFormIdentifier(), CurrentContext.UserId, "Quantity edited");

                XtraMessageBox.Show("Receipt forwarded for quantity confirmation!", "Success", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
                BindFormContents();
            }
        }
コード例 #16
0
        private void NextTab()
        {
            if (selectTab == grpTabInvoiceValue)
            {
                var receipt = new BLL.Receipt(ReceiptID);
                if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE &&
                    receipt.ReceiptInvoice.PO.IsElectronic)
                {
                    CommitUnitCostForElectronicDeliveryNotes();
                }

                LoadSelectedGRVDetailForUnitCostCalculation(ReceiptID);
            }
            else if (selectTab == grpTabUnitCost)
            {
                LoadSelectedGRVDetailForMovingAverage(ReceiptID);
            }
            else
            {
                LoadSelectedGRVDetailForFinalization();
            }
        }
コード例 #17
0
        public static XtraReport GetCostAnalysisPrintout(string GRNString, int ReceiptID)
        {
            BLL.Receipt    receipt = new BLL.Receipt(ReceiptID);
            CostCalculator GRV     = new CostCalculator();

            GRV.LoadGRV(ReceiptID);
            GRV.LoadGRVForCostAnalysis(ReceiptID);
            HCMIS.Desktop.Reports.PreviousCostPrintout xReportCostBuildUp = new HCMIS.Desktop.Reports.PreviousCostPrintout();
            xReportCostBuildUp.DataSource = GRV.PreviousStock;

            HCMIS.Desktop.Reports.CostAnalysisSubReport xReportCostAnalysis = new HCMIS.Desktop.Reports.CostAnalysisSubReport();
            xReportCostAnalysis.DataSource = GRV.CostAnalysis(GRNString);

            HCMIS.Desktop.Reports.CostCalculationPrintout xReportCostCalculationPrintOut = new HCMIS.Desktop.Reports.CostCalculationPrintout();
            xReportCostCalculationPrintOut.DataSource = GRV.GRVDetail;

            HCMIS.Desktop.Reports.CostReport xReportCostReport = new HCMIS.Desktop.Reports.CostReport();
            xReportCostReport.DataSource  = GRV.CostAnalysis(GRNString);
            xReportCostReport.xrDate.Text = EthiopianDate.EthiopianDate.GregorianToEthiopian(BLL.DateTimeHelper.ServerDateTime);
            ReceiveDocConfirmation receiveDocConfirmation = new ReceiveDocConfirmation();
            DataTable Users = receiveDocConfirmation.GetUserNamebyReceipt(ReceiptID);

            if (Users.Rows.Count > 0)
            {
                xReportCostReport.xrCostedBy.Text  = Users.Rows[0]["CostedBy"].ToString();
                xReportCostReport.xrCheckedBy.Text = Users.Rows[0]["CheckedBy"].ToString();
            }

            xReportCostReport.xrWarehouse.Text = receipt.GetWarehouse();
            xReportCostReport.subReportCostCalculation.ReportSource = xReportCostCalculationPrintOut;
            xReportCostReport.xrSubreportCostBuildup.ReportSource   = xReportCostBuildUp;
            xReportCostReport.xrSubreportCostAnalysis.ReportSource  = xReportCostAnalysis;
            xReportCostReport.ShowPrintStatusDialog = true;
            xReportCostReport.CreateDocument();
            xReportCostReport.PrintingSystem.Document.AutoFitToPagesWidth = 1;

            return(xReportCostReport);
        }
        private void LoadSelectedGRVDetailForInvoiceEntry(int ReceiptID)
        {
            //Display Correct Tab
            selectTab = grpTabInvoiceValue;
            FocusOnSelectedTab();

            // Load The GRV First
            GRV = new CenterCostCalculator();
            GRV.LoadGRV(ReceiptID);
            // Display the GRV Detail for Data Entry(Price Per Pack)

            //Please Make-up ur mind solution
            if (BLL.Settings.IsDamageIncludedOnTotalFOB)
                gridInvoiceDetail.DataSource = GRV.GRVDetail;
            else
                gridInvoiceDetail.DataSource = GRV.GRVSoundDetail;
            gridDiscrenpancy.DataSource = GRV.GRVDiscrepancyDetail;

            BLL.Receipt receipt = new BLL.Receipt();
            receipt.LoadByPrimaryKey(ReceiptID);
        }
コード例 #19
0
        private void print()
        {
            DataRow dr = gridGRVsView.GetFocusedDataRow();
            String GRNString = dr["RefNo"].ToString();

            BLL.Receipt receipt = new BLL.Receipt(ReceiptID);

            HCMIS.Desktop.Reports.PreviousCostPrintout xReportCostBuildUp =
                new HCMIS.Desktop.Reports.PreviousCostPrintout();
            xReportCostBuildUp.DataSource = BLL.Receipt.GetPreviousStockforCostAnalysisPrintout(ReceiptID);

            HCMIS.Desktop.Reports.CostAnalysisSubReport xReportCostAnalysis =
                new HCMIS.Desktop.Reports.CostAnalysisSubReport();
            xReportCostAnalysis.DataSource = GRV.CostAnalysis(GRNString);

            HCMIS.Desktop.Reports.CostCalculationPrintout xReportCostCalculationPrintOut =
                new HCMIS.Desktop.Reports.CostCalculationPrintout();
            xReportCostCalculationPrintOut.DataSource = GRV.GRVSoundDetail;

            HCMIS.Desktop.Reports.CostReport xReportCostReport = new HCMIS.Desktop.Reports.CostReport();
            xReportCostReport.DataSource = receipt.CostAnalysis(GRNString);
            xReportCostReport.xrDate.Text = EthiopianDate.EthiopianDate.GregorianToEthiopian(BLL.DateTimeHelper.ServerDateTime);
            xReportCostReport.xrCostedBy.Text = CurrentContext.LoggedInUserName;
            xReportCostReport.xrWarehouse.Text = receipt.GetWarehouse();
            xReportCostReport.subReportCostCalculation.ReportSource = xReportCostCalculationPrintOut;
            xReportCostReport.xrSubreportCostBuildup.ReportSource = xReportCostBuildUp;
            xReportCostReport.xrSubreportCostAnalysis.ReportSource = xReportCostAnalysis;
            xReportCostReport.ShowPrintStatusDialog = true;
            xReportCostReport.CreateDocument();
            xReportCostReport.PrintingSystem.Document.AutoFitToPagesWidth = 1;
            xReportCostReport.ShowPreviewDialog();
            // LOG Cost Analysis printout in PDF Log
            MemoryStream stream = new MemoryStream();
            xReportCostReport.ExportToPdf(stream);
            HCMIS.Core.Distribution.Services.PrintLogService.SavePrintLogNoWait(stream, "CostAnalysis", true, ReceiptID,
                                                                                CurrentContext.UserId,
                                                                                BLL.DateTimeHelper.ServerDateTime);
        }
コード例 #20
0
        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);
                }

            }
        }
コード例 #21
0
 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");
 }
コード例 #22
0
        /// <summary>
        /// Gets the pick list details for order.
        /// </summary>
        /// <param name="ordID">The ord ID.</param>
        /// <param name="Preparedby">The preparedby.</param>
        /// <returns></returns>
        public DataView GetPickListDetailsForOrder(int ordID, string Preparedby)
        {
            this.LoadByOrderID(ordID);
            var query = HCMIS.Repository.Queries.PickList.SelectGetPickListDetailsForOrder(this.ID);
            this.LoadFromRawSql(query);
            // Add important columns
            this.DataTable.Columns.Add("SKUTOPICK", typeof(decimal));
            this.DataTable.Columns.Add("SKUPICKED", typeof(decimal));
            this.DataTable.Columns.Add("BUPICKED", typeof(decimal));
            this.DataTable.Columns.Add("BoxSizeDisplay");
            this.DataTable.Columns.Add("SKUBU", typeof(decimal));
            this.DataTable.Columns.Add("IsManufacturerLocal", typeof(bool));
            this.DataTable.Columns.Add("PrintedSTVNumber", typeof(string));
            this.DataTable.Columns.Add("PhysicalStoreName", typeof(string));
            this.DataTable.Columns.Add("PhysicalStoreTypeID", typeof(int));
            this.DataTable.Columns.Add("PhysicalStoreTypeName", typeof(string));
            this.DataTable.Columns.Add("PreparedBy", typeof(string));
            int i = 1;
            while (!this.EOF)
            {
                decimal packs = Convert.ToDecimal(this.GetColumn("Packs"));

                int manufacturer = Convert.ToInt32(this.GetColumn("ManufacturerID"));
                Manufacturer m = new Manufacturer();
                m.LoadByPrimaryKey(manufacturer);
                if (!m.IsColumnNull("CountryOfOrigin") && m.CountryOfOrigin.Contains("Ethiopia"))
                    this.SetColumn("IsManufacturerLocal", true);
                else
                    this.SetColumn("IsManufacturerLocal", false);

                int recPalletID = Convert.ToInt32(this.GetColumn("ReceivePalletID"));
                ReceivePallet rp = new ReceivePallet();
                rp.LoadByPrimaryKey(recPalletID);
                try
                {
                    ReceiveDoc receiveDoc = new ReceiveDoc();
                    Receipt receipt = new Receipt();
                    receiveDoc.LoadByPrimaryKey(rp.ReceiveID);
                    receipt.LoadByPrimaryKey(receiveDoc.ReceiptID);
                    this.SetColumn("PhysicalStoreName", rp.GetPhysicalStoreName());
                    int physicalStoreTypeID = rp.GetPhysicalStoreTypeID();
                    this.SetColumn("PhysicalStoreTypeID", physicalStoreTypeID);
                    Warehouse phyStoreType = new Warehouse();
                    phyStoreType.LoadByPrimaryKey(physicalStoreTypeID);
                    this.SetColumn("PhysicalStoreTypeName", phyStoreType.Name);
                    if (BLL.Settings.PrintUserNameOnInvoice)
                    {
                        this.SetColumn("PreparedBy", Preparedby);
                    }

                }
                catch
                {

                }

                int itemId = Convert.ToInt32(this.GetColumn("ItemID"));
                int boxLevel = Convert.ToInt32(this.GetColumn("BoxLevel"));
                decimal qtyPerPack = this.Getint("QtyPerPack");
                //im.LoadIMbyLevel(itemId, manufacturer, boxLevel);
                this.SetColumn("SKUTOPICK", (packs));
                this.SetColumn("SKUPICKED", this.GetColumn("SKUTOPICK"));
                // TODO:show the box size here for Program store
                this.SetColumn("BoxSizeDisplay", "");
                this.SetColumn("SKUBU", qtyPerPack);
                this.SetColumn("BUPICKED", qtyPerPack * Convert.ToDecimal(this.GetColumn("SKUPICKED")));
                this.SetColumn("LineNum", i++);
                if (this.IsColumnNull("DeliveryNote"))
                {
                    this.SetColumn("DeliveryNote", false);
                }
                this.MoveNext();
            }
            return this.DefaultView;
        }
コード例 #23
0
 public int Create(Receipt receipt)
 {
     return(ReceiptDAL.Create(receipt));
 }
コード例 #24
0
 public void SaveInsurance()
 {
     Receipt GRV = new Receipt();
        GRV.LoadByPrimaryKey(ReceiptID);
        GRV.Insurance = _Insurance;
        GRV.Provision = _OtherExpense;
        GRV.Save();
 }
コード例 #25
0
        public static XtraReport PrintReceiptConfirmation(string printedBy, int receiptID, int?previousReceiptConfirmationPrintoutID, bool forExporting, FiscalYear fiscalYear)
        {
            var rcPrevious       = new BLL.ReceiptConfirmationPrintout();
            int?idToBePrintedOut = null;

            if (forExporting && previousReceiptConfirmationPrintoutID.HasValue)
            {
                rcPrevious.LoadByPrimaryKey(previousReceiptConfirmationPrintoutID.Value);
                idToBePrintedOut = rcPrevious.IDPrinted;
            }

            var rc       = new BLL.ReceiptConfirmationPrintout();
            var printout =
                new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(printedBy);

            var srmPrintout = new HCMIS.Desktop.Reports.SRMPrintout(printedBy);

            var receiveDoc = new ReceiveDoc();
            var receipt    = new BLL.Receipt();

            receipt.LoadByPrimaryKey(receiptID);
            receiveDoc.LoadByReceiptID(receiptID);

            var referenceNumber = receiveDoc.RefNo;
            var activity        = new Activity();

            activity.LoadByPrimaryKey(receiveDoc.StoreID);
            var supplier = new Supplier();

            supplier.LoadByPrimaryKey(receiveDoc.SupplierID);
            int printedID = 0;

            string GRNFNo = fiscalYear.GetCode(BLL.ReceiptConfirmationPrintout.GetGRNFNo(receiptID));

            if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STANDARD_RECEIPT || receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE || receipt.ReceiptTypeID == ReceiptType.CONSTANTS.ACCOUNT_TO_ACCOUNT_TRANSFER)
            {
                if (!String.IsNullOrEmpty(GeneralInfo.Current.HospitalName))
                {
                    printout.BranchName.Text = GeneralInfo.Current.HospitalName;
                }
                else
                {
                    throw new Exception("Branch name could not be read from the database.");
                }

                PrepareGRVPrintout(printout);
                //  String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();

                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,
                                                          idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear);
                    printout.DataSource = rc.DefaultView.ToTable();
                    var dtDate = new 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,
                                                          idToBePrintedOut, previousReceiptConfirmationPrintoutID, fiscalYear);
                    printout.xrLabelGRNF.Text = GRNFNo;
                    printout.DataSource       = rc.DefaultView.ToTable();

                    var dtDate = new DateTimePickerEx();
                    //dtDate.CustomFormat = "dd/MM/yyyy";
                    dtDate.Value = receiveDoc.EurDate;

                    printout.Date.Text = dtDate.Text;
                }


                printout.xrLabelStoreName.Text = activity.FullActivityName;

                if (ReceiveDoc.IsThereShortageOrDamage(receiptID))
                {
                    ReceiptConfirmationShortagePrintout printoutShortage =
                        PrintReceiptConfirmationForShortage(receiptID, printedID, fiscalYear);

                    PrepareGRVPrintout(printoutShortage);
                    printout.xrShortageReport.ReportSource = printoutShortage;

                    printout.PrintingSystem.ContinuousPageNumbering = true;
                }
                else
                {
                    printout.ReportFooter.Visible = false;
                }
                if (!forExporting) //If this is not for exporting, we print on paper.
                {
                    if (printout.PrintDialog() != DialogResult.OK)
                    {
                        throw new Exception("Print cancelled by user!");
                    }
                }

                return(printout);
            }

            else if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.STOCK_RETURN)
            {
                if (!String.IsNullOrEmpty(GeneralInfo.Current.HospitalName))
                {
                    srmPrintout.BranchName.Text = GeneralInfo.Current.HospitalName;
                }

                rc.PrepareDataForPrintout(receiptID, CurrentContext.UserId, false, 3, idToBePrintedOut,
                                          previousReceiptConfirmationPrintoutID, fiscalYear);
                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 Issue();
                    stvLog.LoadByPrimaryKey(idoc.STVID);
                    var issuedActivity = new Activity();
                    issuedActivity.LoadByPrimaryKey(idoc.StoreId);
                    srmPrintout.xrAccountName.Text = issuedActivity.FullActivityName;
                    srmPrintout.xrSTVNoValue.Text  = stvLog.IDPrinted.ToString("00000");
                }
                else
                {
                    srmPrintout.xrAccountName.Text = activity.FullActivityName;;
                    srmPrintout.xrSTVNoValue.Text  = receiveDoc.RefNo;
                }

                var dtDate = new DateTimePickerEx();
                dtDate.Value          = receiveDoc.EurDate;
                srmPrintout.Date.Text = dtDate.Text;

                if (!forExporting)
                {
                    if (srmPrintout.PrintDialog() != DialogResult.OK)
                    {
                        throw new Exception("Print cancelled by user!");
                    }
                }
                return(srmPrintout);
            }

            else //TODO: Implement Delivery notes.
            {
                return(null);
            }
        }
        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();
            }
        }
コード例 #27
0
        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();
        }
コード例 #28
0
        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);
                }
            }
        }
コード例 #29
0
        /// <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();
            }
        }
コード例 #30
0
        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;
            }
        }
        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();
        }
 public DataView SRMCostAnalysis(JournalEntry UnitCostJournal,string CommodityType, double Stock, double CostOfSales,int receiptID)
 {
     Receipt receipt = new Receipt();
     string facilityName = receipt.FacilityName(receiptID);
     UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", CommodityType), Stock, null);
     UnitCostJournal.AddNewEntry(String.Format("Account Receivable ({0})",facilityName), null, CostOfSales);
     return UnitCostJournal.DefaultView();
 }
コード例 #33
0
        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;
            }
        }
コード例 #34
0
        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();
        }
コード例 #35
0
        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;
            }
        }
コード例 #36
0
 private void btnSearchReceiptID_Click(object sender, EventArgs e)
 {
     BLL.Receipt receipt = new Receipt();
     receipt.LoadSearchDetailsForReceipt(int.Parse(txtReceiptID.Text));
     grdReceiptSearchDetails.DataSource = receipt.DefaultView;
     gridPrintout.DataSource = BLL.Receipt.GetlistOfPrints(int.Parse(txtReceiptID.Text));
     lkReceiptConfirmationStatus.Properties.DataSource = BLL.ReceiptConfirmationStatus.GetAll();
 }
コード例 #37
0
        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);
        }
コード例 #38
0
        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);
        }
コード例 #39
0
        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;
            }

            try
            {
                DataRow dr = gridReceiveView.GetFocusedDataRow();

                if (dr == null)
                {
                    return;
                }

                ReceiptID = Convert.ToInt32(dr["ReceiptID"]);
                BLL.Receipt receiptDoc = new BLL.Receipt();
                receiptDoc.LoadByPrimaryKey(ReceiptID);

                DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF();


                if (GRNFDetail.Rows.Count > 0)
                {
                    //var store = new Store();
                    //store.
                    BLL.PO order = new BLL.PO();
                    //var Mode = new Mode();
                    //Mode.LoadByPrimaryKey(order.ModeID);
                    //lblMode.Text = Mode.TypeName;
                    HeaderSection.Text = GRNFDetail.Rows[0]["PONumber"].ToString();


                    lblRecieveStatus.Text     = dr["recieveStatus"].ToString();
                    lblReceiptNo.Text         = dr["ReceiptNo"].ToString();
                    lblRecievedBy.Text        = dr["ReceivedBy"].ToString();
                    lblRecievedDate.Text      = Convert.ToDateTime(dr["Date"]).ToShortDateString();
                    lblReciveType.Text        = (dr["ReceiveType"]).ToString();
                    lblWayBill.Text           = (dr["WayBillNo"]).ToString() != "" ? dr["WayBillNo"].ToString() : "-";
                    lblTransferVoucherNo.Text = (dr["transferNo"]).ToString() != "" ? dr["transferNo"].ToString() : "-";

                    var warehouse = new BLL.Warehouse();
                    warehouse.LoadByPrimaryKey(receiptDoc.WarehouseID);
                    lblWarehouse.Text = warehouse.Name;
                    lblSupplier.Text  = dr["Supplier"].ToString();

                    var cluster = new BLL.Cluster();
                    cluster.LoadByPrimaryKey(warehouse.ClusterID);
                    lblCluster.Text = cluster.Name;



                    lblDocType.Text = "";

                    lblPoType.Text = dr["POType"].ToString();
                    //var ps = new BLL.PhysicalStore();
                    //ps.LoadByPrimaryKey(order.p);
                    //lblStore.Text = ps.Name;


                    txtOrderNo.EditValue = GRNFDetail.Rows[0]["PONumber"];
                    lblPoNumber.Text     = GRNFDetail.Rows[0]["PONumber"].ToString();

                    lblInvoiceNumber.Text = receiptDoc.STVOrInvoiceNo;

                    lblInsurancePolicy.Text = receiptDoc.InsurancePolicyNo != ""?receiptDoc.InsurancePolicyNo : "-";

                    var activity = new Activity();
                    activity.LoadByPrimaryKey(Convert.ToInt32(GRNFDetail.Rows[0]["ActivityID"]));

                    txtActivity.EditValue = activity.FullActivityName;
                    lblActivity.Text      = activity.Name;

                    lblSubAccount.Text = activity.SubAccountName;
                    lblMode.Text       = activity.ModeName;
                    lblAccount.Text    = activity.AccountName;

                    gridDetails.DataSource = GRNFDetail;
                }

                if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID))
                {
                    gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
                }
            }

            catch
            {
                gridDetails.DataSource = null;
            }
        }
コード例 #40
0
        private void gridGRVs_MouseClick(object sender, MouseEventArgs e)
        {
            DataRow SelectGRV = gridGRVsView.GetFocusedDataRow();
            if (SelectGRV != null)
            {
                ReceiptID = Convert.ToInt32(SelectGRV["ReceiptID"]);
                PONumber = Convert.ToString(SelectGRV["PONumber"]);
                LoadSelectedGRVDetailForInvoiceEntry(ReceiptID);
                BLL.Receipt receipt = new BLL.Receipt();
                string s = "";

                int length = ((string) SelectGRV["InvoiceNumber"]).Length;
                headerSection.Text = "Invoice No: " + (string)SelectGRV["InvoiceNumber"] + s.PadRight(180-length) + "GRNF No: " + (string)SelectGRV["RefNo"].ToString();

                lblMode.Text = (string)SelectGRV["Mode"];
                lblAccount.Text = (string)SelectGRV["AccountName"];
                lblSubAccount.Text = (string)SelectGRV["SubAccountName"];
                lblActivity.Text = (string)SelectGRV["ActivityName"];
                lblWarehouse.Text = (string)SelectGRV["WarehouseName"];
                lblCluster.Text = (string)SelectGRV["ClusterName"];
                lblReceiptType.Text = (string)SelectGRV["ReceiveType"];
                lblRecieptStatus.Text = (string)SelectGRV["ReceiveStatus"];
                lblSupplier.Text = (string)SelectGRV["SupplierName"];
                lblOrderNo.Text = (string)SelectGRV["PONumber"];

                lblConfirmedBy.Text = SelectGRV["ConfirmedBy"] == DBNull.Value ? "-" : (string)SelectGRV["ConfirmedBy"];

                lblConfirmedDate.Text = SelectGRV["ConfirmedTime"] != DBNull.Value ? Convert.ToDateTime(SelectGRV["ConfirmedTime"]).ToShortDateString() : "-";

                lblReceivedBy.Text = (string)SelectGRV["ReceivedBy"];
                lblRecieptDate.Text = ((DateTime)SelectGRV["ReceivedTime"]).ToShortDateString();
                lblInsurance.Text = SelectGRV["InsuranceNumber"] == DBNull.Value ? "" : (string)SelectGRV["InsuranceNumber"];
                //to handle STVNumber entry
                receipt.LoadByPrimaryKey(ReceiptID);
                NoSelection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                Selection.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                layoutSTVNo.Enabled = true;
                if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE)
                {
                    var newInvoiceNo = receipt.GetNewInvoiceNoForConvertedDeliveryNote();
                    txtSTVNo.EditValue = newInvoiceNo != string.Empty ? newInvoiceNo : string.Empty;
                    layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                    layoutSTVNo.Enabled = false;
                }
                else
                {
                    layoutSTVNo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                }
            }
            else
            {
                ResetForm();
            }
        }
コード例 #41
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();
            }
        }
コード例 #42
0
        private void NextTab()
        {
            if (selectTab == grpTabInvoiceValue)
            {
                var receipt = new BLL.Receipt(ReceiptID);
                if (receipt.ReceiptTypeID == ReceiptType.CONSTANTS.DELIVERY_NOTE
                    && receipt.ReceiptInvoice.PO.IsElectronic)
                    CommitUnitCostForElectronicDeliveryNotes();

                LoadSelectedGRVDetailForUnitCostCalculation(ReceiptID);
            }
            else if (selectTab == grpTabUnitCost)
                LoadSelectedGRVDetailForMovingAverage(ReceiptID);
            else
                LoadSelectedGRVDetailForFinalization();
        }
コード例 #43
0
 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);
 }
        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);
        }
コード例 #45
0
 public void LoadPreviousStockForCostAnalysis(int ReceiptID)
 {
     _PreviousStock = Receipt.GetPreviousStockforMovingCosting(ReceiptID);
 }
コード例 #46
0
 public void LoadGRVPreviousStock()
 {
     _PreviousStock = Receipt.GetPreviousStockforMovingCosting(ReceiptID);
 }
コード例 #47
0
        private void PrintPutaway()
        {
            // Show Column
            // Confirmation.Visible = true;
            Confirmation1.Visible = true;
            //gridPutAwayPalletized.ShowPrintPreview();

            if (gridPutAwayNonPalletized.DataSource != null &&
                (gridPutAwayNonPalletized.DataSource as DataTable).Rows.Count > 0)
            {
                //  gridPutAwayNonPalletized.ShowPrintPreview();
            }

            // TODO: Fix this to show all the appropriate items
            //compositeLink1.PrintingSystem = new DevExpress.XtraPrinting.PrintingSystem();
            //compositeLink1.ShowPreview();

            HCMIS.Desktop.Reports.GoodsReceivingNote note = new HCMIS.Desktop.Reports.GoodsReceivingNote();
            BLL.Receipt rct = new BLL.Receipt();
            var activity = new Activity();
            activity.LoadByPrimaryKey(storeID);
            note.xrLabelAccounts.Text = activity.FullActivityName;
            note.DataSource = rct.GetReceiptInformationForGRN(_receiptID);

            if (BLL.Settings.IsCenter)
            {
                note.xrPOrderNo.Visible = false;
                note.xrPOrderNoValue.Visible = false;
                note.xrAirWayNo.Visible = false;
                note.xrAirWayNoValue.Visible = false;
                note.xrTransitTransferNo.Visible = false;
                note.xrTransitTransferNoValue.Visible = false;
                note.xrInsurancePolicyNo.Visible = false;
                note.xrInsurancePolicyNoValue.Visible = false;
            }

            //note.ShowPreviewDialog();

            // Hide Column
            Confirmation1.Visible = false;
            //Confirmation.Visible = false;
        }
 public void SaveTotalCost()
 {
     Receipt GRV = new Receipt();
     GRV.LoadByPrimaryKey(ReceiptID);
     GRV.TotalValue = _SubTotal;
     GRV.Save();
 }
コード例 #49
0
        private void SaveReceive()
        {
            // Merge all Receives with Same Item information and Assigned to Same PhysicalStore as One Item , Quantity Sumed UP!
            MergeReceiveDocLines();

            BLL.ReceiveDoc rec = new ReceiveDoc();

            ////int receiptTypeID = srm
            ////    ? ReceiptType.CONSTANTS.STOCK_RETURN
            ////    : (deliveryNoteType != DeliveryNoteType.NotSet)
            ////        ? ReceiptType.CONSTANTS.DELIVERY_NOTE
            ////        : beginningBalance
            ////            ? ReceiptType.CONSTANTS.BEGINNING_BALANCE
            ////            : ReceiptType.CONSTANTS.STANDARD_RECEIPT;
            int receiptID;
            int warehouseID = Convert.ToInt32(lkWarehouse.EditValue);

            receiptID = SaveRelevantReceiptHeaders(_receiptTypeID, warehouseID);

            DataTable zeroQuantitiesDueToMultipleBatch = null;
            DataRow [] zeroQuantityRows =
                _dtRecGrid.Select(string.Format("[Pack Qty] = 0"),"[Ordering] ASC ");

            if (zeroQuantityRows.Any() && zeroQuantityRows.Any(r => r["ShortageReasonID"] == DBNull.Value))
            {
                zeroQuantityRows = CheckAndRemoveIfFullNotReceiveEntry(zeroQuantityRows);
                if (zeroQuantityRows.Any())
                    zeroQuantitiesDueToMultipleBatch =
                        zeroQuantityRows.Where(r => r["ShortageReasonID"] == DBNull.Value).CopyToDataTable();
            }

            var mergeableTables = _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC ");
            DataTable mergedDataTable = null;
            if (mergeableTables.Any())
            {
                mergedDataTable =
                    _dtRecGrid.Select(string.Format("[Pack Qty] > 0 "), "[Ordering] ASC ").CopyToDataTable();

                if (zeroQuantitiesDueToMultipleBatch != null)
                    mergedDataTable.Merge(zeroQuantitiesDueToMultipleBatch);

                if (grdShortageOrDamaged.DataSource != null)
                {
                    var shortageOrDamage = (DataTable) grdShortageOrDamaged.DataSource;
                    mergedDataTable.Merge(shortageOrDamage);
                }
            }
            else
            {
                if (grdShortageOrDamaged.DataSource != null)
                {
                    var shortageOrDamage = (DataTable)grdShortageOrDamaged.DataSource;
                    if (zeroQuantitiesDueToMultipleBatch != null)
                        shortageOrDamage.Merge(zeroQuantitiesDueToMultipleBatch);
                    //~ {"[ShortageReasonID] ASC} --> Just to give priority among shortages to Damaged reasons as we will create a receiveDoc entry for this ~//
                    mergedDataTable = mergedDataTable == null ? shortageOrDamage.Select(string.Format("[Pack Qty] >= 0 "), "[ShortageReasonID] ASC ").CopyToDataTable() : shortageOrDamage;

                }
            }

            foreach (DataRowView dr in mergedDataTable.DefaultView)
            {
                var shortageReasonID = dr["ShortageReasonID"];

                var onlyOneEntryFound = _dtRecGrid.Select(String.Format("GUID = '{0}'", dr["GUID"]));

                bool zeroQtyDueTomultipleBatchFound = (Convert.ToDecimal(dr["Pack Qty"]) == 0) && (shortageReasonID == DBNull.Value) && (onlyOneEntryFound.Count() == 1);
                bool fullNotReceivedEntry = (Convert.ToDecimal(dr["BU Qty"]) == 0) && (shortageReasonID != DBNull.Value) && (Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.NOT_RECEIVED) && (onlyOneEntryFound.Count() == 1);
                if (fullNotReceivedEntry)
                {
                    dr["Pack Qty"] = 0;
                }

                var item = new Item();
                item.LoadByPrimaryKey(Convert.ToInt32(dr["ID"]));

                if (item.NeedExpiryBatch || (shortageReasonID == DBNull.Value && ((dr["Expiry Date"] != DBNull.Value) && (Convert.ToDateTime(dr["Expiry Date"]) <= DateTimeHelper.ServerDateTime))))
                {

                    var expDate = Convert.ToDateTime(dr["Expiry Date"]);

                    if ((shortageReasonID == DBNull.Value && expDate > DateTimeHelper.ServerDateTime) || zeroQtyDueTomultipleBatchFound)
                    {
                        AddNewReceiveDoc(rec, receiptID, dr);
                    }
                    else
                    {
                        //for physically Damaged receives and expired receives
                        if ((shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED) || (shortageReasonID == DBNull.Value && expDate <= DateTimeHelper.ServerDateTime) || fullNotReceivedEntry)
                        {
                            AddNewReceiveDoc(rec, receiptID, dr, true);
                            if (shortageReasonID == DBNull.Value)
                            {
                                dr["ShortageReasonID"] = ShortageReasons.Constants.DAMAGED;
                            }
                        }
                        else
                        {

                            HandleReceiveDocShortage(dr, rec);
                        }
                    }
                }
                else
                {

                    if ((shortageReasonID == DBNull.Value) || zeroQtyDueTomultipleBatchFound)
                    {
                        AddNewReceiveDoc(rec, receiptID, dr);
                    }
                    else
                    {
                        //for physically Damaged receives
                        if (shortageReasonID != DBNull.Value && Convert.ToInt32(shortageReasonID) == ShortageReasons.Constants.DAMAGED || fullNotReceivedEntry)
                        {
                            AddNewReceiveDoc(rec, receiptID, dr, true);
                        }
                        else
                        {
                            HandleReceiveDocShortage(dr, rec);
                        }

                    }
                }

            }

            rec.SetStatusAsReceived(CurrentContext.UserId);

            BLL.Receipt receiptStatus = new BLL.Receipt();
            receiptStatus.LoadByPrimaryKey(receiptID);
            receiptStatus.ChangeStatus(ReceiptConfirmationStatus.Constants.RECEIVE_ENTERED, null,
                this.GetFormIdentifier(), CurrentContext.UserId, "Received");
            if (!BLL.Settings.HandleGRV) //If HandleGRV is true, the price isn't entered in the receive stage meaning
            {
                rec.Rewind();
                while (!rec.EOF)
                {
                    if (!ReceiveDoc.DoesPriceNeedToBeChanged(rec.StoreID, rec.ItemID, rec.UnitID, rec.ManufacturerId) &&
                        (deliveryNoteType == DeliveryNoteType.NotSet))
                    {
                        rec.SellingPrice = rec.Cost;
                        rec.UnitCost = Convert.ToDecimal(rec.Cost);
                        // Added by Heny In order to display Unit Cost on Vaccine
                        rec.Margin = 0;
                    }
                    rec.MoveNext();
                }
            }

            rec.Save(); //TODO: To be removed after the ShortageReasonID in receviedoc is discontinued.

            //SavePalletization(rdDamaged);
            _revDocRelatePalletGuid.Clear();
        }
コード例 #50
0
        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();
        }
コード例 #51
0
        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;
        }
コード例 #52
0
        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;
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="refNo"></param>
        /// <param name="userID"></param>
        /// <param name="shortageAndDamage"></param>
        /// <param name="preGRVOrGRVOrSRM">1-PreGRV, 2-GRV, 3-SRM, 4-iGRV, 5-DeliveryNote</param>
        /// <param name="IDToBePrintedOut">Only applicable for the shortage where we need to show the same ID</param>
        /// <returns></returns>
        public int PrepareDataForPrintout(int ReceiptID, int? userID, bool shortageAndDamage, int preGRVOrGRVOrSRM, int? IDToBePrintedOut, int? isReprintOfRCPrintoutID,FiscalYear fiscalYear)
        {
            string query = "";

            if (!shortageAndDamage && preGRVOrGRVOrSRM != 3)
            {
                query =
                    HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID, StorageType.Quaranteen);
            }
            else if (preGRVOrGRVOrSRM == 3)//SRM
            {
                BLL.ReceiveDoc rd = new ReceiveDoc();
                rd.LoadAllByReceiptID(ReceiptID);
                if (rd.IsColumnNull("ReturnedFromIssueDocID")) //This is an SRM done for an issue from the old system. (The issue was done using the old system)
                {
                    query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueDone(ReceiptID);
                }
                else //This is a normal SRM (Both the issue and the receive were done using this system)
                {
                    query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintoutIssueAndReceiveDone(ReceiptID);

                }
            }
            else
            {
                //Cost Calculations should be removed from the query below
                query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID);
            }
            this.LoadFromRawSql(query);

            if (this.RowCount == 0)
            {
                if (ReceiveDoc.IsThereShortageOrDamage(ReceiptID))
                {
                    query = HCMIS.Repository.Queries.ReceiptConfirmationPrintout.SelectPrepareDataForPrintout(ReceiptID);
                    this.LoadFromRawSql(query);
                }
                if (this.RowCount == 0)
                    throw new Exception("No Data To Print, please receive Document before Trying again");

            }

            this.Rewind();

            this.AddColumn("LineNum", typeof(int));
            this.AddColumn("PrintedGRVNumber", typeof(string));

            BLL.Receipt receipt = new Receipt();
            int receiptID = int.Parse(this.GetColumn("ReceiptID").ToString());
            receipt.LoadByPrimaryKey(receiptID);

            int receiptTypeID = receipt.ReceiptTypeID;
            int printedGRVNumber;
            int lineNum = 1;
            int totalItems = 0;

            BLL.ReceiptConfirmationPrintout rcp = new ReceiptConfirmationPrintout();
            int? supplierID = null;
            if (preGRVOrGRVOrSRM != 3)
                supplierID = this.SupplierID;
            if (IDToBePrintedOut.HasValue)
            {
                printedGRVNumber = IDToBePrintedOut.Value;
            }
            else
            {
               printedGRVNumber = rcp.AddNew(this.StoreID, supplierID, receiptTypeID == 2 ? null : userID, receipt.ID,
                           preGRVOrGRVOrSRM, isReprintOfRCPrintoutID);
            }

            if (!IDToBePrintedOut.HasValue) //We want to save a new receipt confirmation printout only when a new ID is generated (Not when an ID to be printed has been passed as a parameter)
            {
                 //For delivery note only, we don't save the saved by user id so that we don't say GRV has been printed.
            }

            while (!this.EOF)
            {
                this.SetColumn("LineNum", lineNum);
                lineNum++;
                this.SetColumn("PrintedGRVNumber", fiscalYear.GetCode(printedGRVNumber));

                totalItems++;
                this.MoveNext();
            }

            return  printedGRVNumber;
        }
コード例 #54
0
        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;
        }
コード例 #55
0
 public void Update(Receipt receipt)
 {
     ReceiptDAL.Update(receipt);
 }
コード例 #56
0
        private void gridReceiveView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            // Bind the detail grid
            var pl = new PalletLocation();
            try
            {
                String reference = gridReceiveView.GetFocusedDataRow()["RefNo"].ToString();

                ReceiptID = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["ReceiptID"]);
                BLL.Receipt receiptDoc = new BLL.Receipt();
                receiptDoc.LoadByPrimaryKey(ReceiptID);
                DataTable GRNFDetail = receiptDoc.GetDetailsForGRNF();
                gridDetails.DataSource = GRNFDetail;
                gridShortage.DataSource = receiptDoc.GetDiscrepancyForGRNF();
                int status = Convert.ToInt32(gridReceiveView.GetFocusedDataRow()["Status"]);

                var receipt = new BLL.Receipt();
                receipt.LoadByPrimaryKey(ReceiptID);
            }

            catch
            {
                gridDetails.DataSource = null;
                gridShortage.DataSource = null;
            }
        }
コード例 #57
0
        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 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();
        }
コード例 #59
0
        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();
        }