コード例 #1
0
        public void RecordAverageCostAndSellingPrice(int userID)
        {
            MyGeneration.dOOdads.TransactionMgr transaction = MyGeneration.dOOdads.TransactionMgr.ThreadTransactionMgr();

            try
            {
                transaction.BeginTransaction();
                DataTable           ReceiveDocDetails;
                IList <CostElement> costElements = new List <CostElement>();

                foreach (DataRowView drv in GRVSoundDetail.DefaultView as DataView)
                {
                    double NewUnitCost, NewSellingPrice;
                    if (drv["AverageCost"] != DBNull.Value && drv["SellingPrice"] != DBNull.Value)
                    {
                        CostElement costElement = new CostElement();
                        costElement.ItemID          = Convert.ToInt32(drv["ItemID"]);
                        costElement.ItemUnitID      = Convert.ToInt32(drv["ItemUnitID"]);
                        costElement.MovingAverageID = Convert.ToInt32(drv["MovingAverageID"]);
                        costElement.ManufacturerID  = Convert.ToInt32(drv["ManufacturerID"]);
                        costElement.AverageCost     = costElement.SellingPrice = Math.Round(Convert.ToDouble(drv["SellingPrice"]), Settings.NoOfDigitsAfterTheDecimalPoint);
                        costElement.Margin          = drv["Margin"] != DBNull.Value ? Convert.ToDouble(drv["Margin"]) : 0;
                        ReceiveDocDetails           =
                            ReceiveDoc.GetRelatedReceiveForUnitCostAndSellingPrice(ReceiptID, costElement);


                        foreach (DataRowView Cursor in ReceiveDocDetails.AsDataView())
                        {
                            int ID = Convert.ToInt32(Cursor["ID"]);
                            ReceiveDoc.SetAverageCostByReceiveDoc(ID, costElement.AverageCost, userID);
                            ReceiveDoc.SetSellingPriceByReceiveDoc(ID, costElement.SellingPrice, userID);
                        }
                        costElements.Add(costElement);
                    }
                }
                try
                {
                    CostingService.SavePriceChange(costElements.AsEnumerable(), userID, ChangeMode.Recieve, ReceiptID.ToString());
                }
                catch (Exception)
                {
                    //Until Cost Tier Implementation
                }
                transaction.CommitTransaction();
            }
            catch (Exception ex)
            {
                transaction.RollbackTransaction();
                throw ex;
            }
        }
コード例 #2
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);
        }
コード例 #3
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);
            }
        }
コード例 #4
0
        public static DataTable GetPreviousStockforCostAnalysisPrintout(int ReceiptID)
        {
            Receipt receipt = new Receipt();
            string  query   = HCMIS.Repository.Queries.Receipt.SelectGetPreviousStockforCostAnalysisPrintout(ReceiptID);

            receipt.LoadFromRawSql(query);
            if (BLL.Settings.UseCostTier)
            {
                query = HCMIS.Repository.Queries.Receipt.SelectGetPreviousStockforCostAnalysisPrintoutUseCostTier(ReceiptID);
                receipt.LoadFromRawSql(query);
                return(CostingService.SetPrice(receipt.DataTable));
            }
            return(receipt.DataTable);
        }
コード例 #5
0
        public AppService(AppDbContext db)
        {
            Phone           = new PhoneService(db, this);
            Company         = new CompanyService(db, this);
            CallRecord      = new CallRecordService(db, this);
            State           = new StateService(db, this);
            SystemSetting   = new SystemSettingService(db, this);
            CostingTemplate = new CostingTemplateService(db, this);
            QuoteTemplate   = new QuoteTemplateService(db, this);
            Quote           = new QuoteService(db, this);
            Costing         = new CostingService(db, this);
            CallScript      = new CallScriptService(db, this);
            CallQuestion    = new CallQuestionService(db, this);
            CallAnswer      = new CallAnswerService(db, this);

            _appDbContext = db;
        }