Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void SaveBt_Click(object sender, EventArgs e)
        {
            DocumentDetailsLogic details = new DocumentDetailsLogic(manager);

            if (wareSelectorUC1.WareID != null)
            {
                int     wareId                = (int)(wareSelectorUC1.WareID);
                decimal unitQuantity          = Convert.ToDecimal(UnitQuantityNUD.Value);
                decimal secondaryUnitQuantity = Convert.ToDecimal(SecondaryUnitQuantityNUD.Value);
                decimal priceForUnit          = Convert.ToDecimal(UnitPriceNUD.Value);
                decimal discountForUnit       = Convert.ToDecimal(DiscountForUnitNUD.Value);
                decimal endSalePriceForUnit   = Convert.ToDecimal(priceForUnit - discountForUnit);
                decimal endPrice              = Convert.ToDecimal(endSalePriceForUnit * unitQuantity);
                int     currencyId            = Convert.ToInt32(Document.CurrencyID);



                //MessageBox.Show(wareId.ToString());
                if (mode == "new")
                {
                    //створюємо новий запис в деталізації документа і повертаємо його
                    DocumentDetail = details.CreateWithNoSave(wareId, unitQuantity, secondaryUnitQuantity,
                                                              priceForUnit, discountForUnit, endSalePriceForUnit, endPrice, currencyId, -1);
                    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();
                MessageL.Text = "Додано";
            }
        }
Exemplo 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();
            }
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
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();
            }
        }