Esempio n. 1
0
        public DocumentDetailsData(string _mode, WareDocument document, List<WareDocumentDetail> documentDetails, WareDocumentDetail documentDetail)
        {
            InitializeComponent();
            manager = new ContextManager();
            mode = _mode;
            MessageL.Text = "";

            Document = document;
            DocumentDetails = documentDetails;
            DocumentDetail = documentDetail;

            FillWares();
            FillPriceGroups();
            FillCurrencies();
            Fill();
            if (mode == "edit")
            {

            }
        }
Esempio n. 2
0
        /// <summary>
        /// Додавання позицій в документ по коду одиниці
        /// </summary>
        /// <param name="WareCode"></param>
        /// <returns></returns>
        private WareDocumentDetail AddDocumenDetailByWareCode(string WareCode)
        {
            DocumentDetailsLogic details = new DocumentDetailsLogic(manager);
            WareCodesLogic wareCodesLogic = new WareCodesLogic(manager);
            WareDocumentDetail result = null;
            Ware ware = wareCodesLogic.GetWareByCode(WareCode);
            if (ware != null)
            {
                int wareId = ware.ID;
                decimal unitQuantity = 1;
                decimal secondaryUnitQuantity = 0;
                decimal priceForUnit = 0;
                decimal discountForUnit = 0;
                decimal endSalePriceForUnit = 0;
                decimal endPrice = 0;

                int currencyId = Convert.ToInt32(CurrencyLUE.EditValue);
                int priceGroupID = 1;

                WareDocumentDetail DocumentDetail = new WareDocumentDetail();
                //створюємо новий запис в деталізації документа і повертаємо його
                DocumentDetail = details.CreateWithNoSave(wareId, unitQuantity, secondaryUnitQuantity,
                    priceForUnit, discountForUnit, endSalePriceForUnit, endPrice, currencyId, priceGroupID);
                documentDetailsView.Add(DocumentDetail);
                result = DocumentDetail;
                FillDetails();
            }
            else
            {
                MessageBox.Show("Товар з даним кодом не знайдено");
            }
            return result;
        }
Esempio n. 3
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            if (dxValidationProvider1.Validate() == true)
            {

                DocumentDetailsLogic details = new DocumentDetailsLogic(manager);
                int wareId = (int)(WareLUE.EditValue);
                decimal unitQuantity = Convert.ToDecimal(UnitQuantityTB.Text);
                decimal secondaryUnitQuantity = Convert.ToDecimal(SecondaryUnitQuantityTB.Text);
                decimal priceForUnit = Convert.ToDecimal(SalePriceForUnitTB.Text);
                decimal discountForUnit = Convert.ToDecimal(DiscountForUnitTB.Text);
                decimal endSalePriceForUnit = Convert.ToDecimal(EndSalePriceForUnitTB.Text);
                decimal endPrice = Convert.ToDecimal(SalePriceTB.Text);
                int currencyId = Convert.ToInt32(CurrencyLUE.EditValue);
                int priceGroupID = Convert.ToInt32(PriceGroupsCBE.EditValue);

                //MessageBox.Show(wareId.ToString());
                if (mode == "new")
                {
                    //створюємо новий запис в деталізації документа і повертаємо його
                    DocumentDetail = details.CreateWithNoSave(wareId, unitQuantity, secondaryUnitQuantity,
                        priceForUnit, discountForUnit, endSalePriceForUnit, endPrice, currencyId, priceGroupID);
                    DocumentDetails.Add(DocumentDetail);

                }
                if (mode == "edit")
                {
                    //DocumentDetails.Remove(DocumentDetail);
                    DocumentDetail.UnitQuantity = unitQuantity;
                    DocumentDetail.SecondaryUnitQuantity = secondaryUnitQuantity;
                    DocumentDetail.PriceForUnit = priceForUnit;
                    DocumentDetail.DiscountForUnit = discountForUnit;
                    DocumentDetail.EndPriceForUnit = endSalePriceForUnit;
                    DocumentDetail.EndPrice = endPrice;
                    DocumentDetail.CurrencyID = currencyId;

                    //DocumentDetails.Add(DocumentDetail);

                }
                //manager.Save();

                this.Close();
            }
        }