Exemplo n.º 1
0
        private void OnConfirmClicked(object sender, EventArgs e)
        {
            printDialog = new PrintDialog();

            if (printDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                XtraMessageBox.Show("Print has been Canceled By User");
                return;
            }
            if (BLL.Settings.IsCenter)
            {
                GRV = new CenterCostCalculator();
                GRV.LoadGRV(ReceiptID);
                GRV.CalculateFinalCost();
            }
            else
            {
                GRV = new CostCalculator();
                GRV.LoadGRV(ReceiptID);
                (GRV as CostCalculator).LoadGRVPreviousStock();
                GRV.CalculateFinalCost();
            }
            if (!SetSellingPrice(GRV))
            {
                return;
            }

            HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName);
            MyGeneration.dOOdads.TransactionMgr transaction            = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
            try
            {
                transaction.BeginTransaction();
                // This is where we set the Price for the previous Stock
                foreach (CostElement costElement in GRV.CostElements)
                {
                    costElement.PreviousCostDetials.Confirm(CurrentContext.UserId);
                }
                printout = PrintConfirmation(null);
                CostingService.ConfirmPriceChange(GRV.CostElements, CurrentContext.UserId, ChangeMode.Recieve, ReceiptID.ToString());
                GRV.SetFinalCostlog(CurrentContext.UserId);
                transaction.CommitTransaction();
            }
            catch (Exception ex)
            {
                transaction.RollbackTransaction();

                XtraMessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                throw;
            }
            printout.Print(printDialog.PrinterSettings.PrinterName);
        }
Exemplo n.º 2
0
        private void OnConfirmClicked(object sender, EventArgs e)
        {
            if (BLL.Settings.IsCenter)
            {
                GRV = new CenterCostCalculator();
                GRV.LoadGRV(ReceiptID);
                GRV.CalculateFinalCost();
            }
            else
            {
                GRV = new CostCalculator();
                GRV.LoadGRV(ReceiptID);
                (GRV as CostCalculator).LoadGRVPreviousStock();
                GRV.CalculateFinalCost();
            }
            if (!SetSellingPrice(GRV))
            {
                return;
            }

            TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr();

            try
            {
                transaction.BeginTransaction();
                // This is where we set the Price for the previous Stock
                foreach (CostElement costElement in GRV.CostElements)
                {
                    costElement.PreviousCostDetials.Confirm(CurrentContext.UserId);
                }

                PrintConfirmation(null);
                try
                {
                    CostingService.ConfirmPriceChange(GRV.CostElements, CurrentContext.UserId, ChangeMode.Recieve, ReceiptID.ToString());
                }
                catch (Exception exception)
                {
                    XtraMessageBox.Show(exception.Message);
                    throw exception;
                }
                transaction.CommitTransaction();
                this.LogActivity("Print-SRM", ReceiptID);
            }
            catch (Exception ex)
            {
                transaction.RollbackTransaction();
                XtraMessageBox.Show(ex.Message);
            }
        }
        private void OnConfirmClicked(object sender, EventArgs e)
        {
            if (BLL.Settings.IsCenter)
                {
                    GRV = new CenterCostCalculator();
                    GRV.LoadGRV(ReceiptID);
                    GRV.CalculateFinalCost();
                }
                else
                {
                    GRV = new CostCalculator();
                    GRV.LoadGRV(ReceiptID);
                    (GRV as CostCalculator).LoadGRVPreviousStock();
                    GRV.CalculateFinalCost();
                }
                if(!SetSellingPrice(GRV))
                {
                    return;
                }

            TransactionMgr transaction = TransactionMgr.ThreadTransactionMgr();
            try
            {
                transaction.BeginTransaction();
                // This is where we set the Price for the previous Stock
                foreach (CostElement costElement in GRV.CostElements)
                {
                    costElement.PreviousCostDetials.Confirm(CurrentContext.UserId);
                }

                PrintConfirmation(null);
                try
                {
                    CostingService.ConfirmPriceChange(GRV.CostElements, CurrentContext.UserId, ChangeMode.Recieve, ReceiptID.ToString());

                }
                catch (Exception exception)
                {
                    XtraMessageBox.Show(exception.Message);
                    throw exception;
                }
                transaction.CommitTransaction();
                this.LogActivity("Print-SRM", ReceiptID);
            }
            catch (Exception ex)
            {
                transaction.RollbackTransaction();
                XtraMessageBox.Show(ex.Message);
            }
        }
        private void OnConfirmClicked(object sender, EventArgs e)
        {
            printDialog = new PrintDialog();

                if (printDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
               {
                   XtraMessageBox.Show("Print has been Canceled By User");
                   return;
               }
                if (BLL.Settings.IsCenter)
                {
                    GRV = new CenterCostCalculator();
                    GRV.LoadGRV(ReceiptID);
                    GRV.CalculateFinalCost();
                }
                else
                {
                    GRV = new CostCalculator();
                    GRV.LoadGRV(ReceiptID);
                    (GRV as CostCalculator).LoadGRVPreviousStock();
                    GRV.CalculateFinalCost();
                }
                if(!SetSellingPrice(GRV))
                {
                    return;
                }

                HCMIS.Desktop.Reports.ReceiptConfirmationPrintout printout = new HCMIS.Desktop.Reports.ReceiptConfirmationPrintout(CurrentContext.LoggedInUserName);
                MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();
                try
                {
                  transaction.BeginTransaction();
                  // This is where we set the Price for the previous Stock
                  foreach (CostElement costElement in GRV.CostElements)
                  {
                          costElement.PreviousCostDetials.Confirm(CurrentContext.UserId);
                  }
                    printout = PrintConfirmation(null);
                    CostingService.ConfirmPriceChange(GRV.CostElements, CurrentContext.UserId, ChangeMode.Recieve, ReceiptID.ToString());
                    GRV.SetFinalCostlog(CurrentContext.UserId);
                    transaction.CommitTransaction();
                }
                catch (Exception ex)
                {
                    transaction.RollbackTransaction();

                    XtraMessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
                    throw ;
                }
                printout.Print(printDialog.PrinterSettings.PrinterName);
        }