Ejemplo n.º 1
0
        internal static void CreateNewAcceptance(AcceptancePlan acceptancePlan)
        {
            if (!@"Створити ""Приймання товару""".Ask())
            {
                return;
            }

            var acceptance = new AcceptanceOfGoods();

            acceptance.Date       = DateTime.Now;
            acceptance.Driver     = acceptancePlan.Driver;
            acceptance.Car        = acceptancePlan.Car;
            acceptance.Contractor = acceptancePlan.Contractor;
            acceptance.fillPlan(acceptancePlan.Date);
            if (acceptance.Write() != WritingResult.Success)
            {
                @"Невдала спроба запису документу ""Приймання товару""!".WarningBox();
            }
        }
Ejemplo n.º 2
0
        private void addPlanDocument(long acceptancePlanId)
        {
            var row = Plans.GetNewRow(this);

            row[AcceptancePlan] = acceptancePlanId;
            row.AddRowToTable(this);

            var acceptancePlan = new AcceptancePlan()
            {
                ReadingId = acceptancePlanId
            };

            foreach (DataRow stickerRow in acceptancePlan.Stickers.Rows)
            {
                var sticker = new Stickers()
                {
                    ReadingId = stickerRow[acceptancePlan.Sticker]
                };
                addWaresFromSticker(sticker);
            }
        }
Ejemplo n.º 3
0
        private bool isLastPlan(AcceptancePlan document)
        {
            var q = DB.NewQuery(@"with caps as (
            select Id from AcceptancePlan

            where CAST([Date] as date) = @Date
            and Driver = @Driver
            and Car = @Car
            and MarkForDeleting = 0
            ), stickersCount as (
             select caps.Id, count(stickers.LineNumber) stickersCount

             from caps
             left join SubAcceptancePlanStickers stickers on caps.Id = stickers.IdDoc
             group by caps.Id
             )

             select count(*) quantity from stickersCount where stickersCount = 0");
            q.AddInputParameter("Date", document.Date.StartOfDay());
            q.AddInputParameter("Driver", document.Driver.Id);
            q.AddInputParameter("Car", document.Car.Id);
            var plansCount = q.SelectScalar();

            return q.ThrowedException == null && Convert.ToInt32(plansCount) == 0;
        }
Ejemplo n.º 4
0
        /// <summary>Заповнення форми даними ініціалізації</summary>
        /// <param name="data">Дані</param>
        private void fillInitData(AcceptancePlanData data)
        {
            //Document
            Document = new AcceptancePlan() { ReadingId = data.Invoice.Key };

            //Fields
            invoiceDate.Text = NavigatedButton.SPACES_FOR_ICOx32 + Document.Date.ToShortDateString();
            invoiceNumber.Text = Document.IncomeNumber;
            driver.Text = setValueIntoButton(Document.Driver.Description);
            car.Text = setValueIntoButton(Document.Car.Description);
            choseWare(WaresTypes.Production);
        }
Ejemplo n.º 5
0
        private void addPlanDocument(long acceptancePlanId)
        {
            var row = Plans.GetNewRow(this);
            row[AcceptancePlan] = acceptancePlanId;
            row.AddRowToTable(this);

            var acceptancePlan = new AcceptancePlan() { ReadingId = acceptancePlanId };
            foreach (DataRow stickerRow in acceptancePlan.Stickers.Rows)
                {
                var sticker = new Stickers() { ReadingId = stickerRow[acceptancePlan.Sticker] };
                addWaresFromSticker(sticker);
                }
        }
Ejemplo n.º 6
0
        internal static void CreateNewAcceptance(AcceptancePlan acceptancePlan)
        {
            if (!@"Створити ""Приймання товару""".Ask()) return;

            var acceptance = new AcceptanceOfGoods();
            acceptance.Date = DateTime.Now;
            acceptance.Driver = acceptancePlan.Driver;
            acceptance.Car = acceptancePlan.Car;
            acceptance.Contractor = acceptancePlan.Contractor;
            acceptance.fillPlan(acceptancePlan.Date);
            if (acceptance.Write() != WritingResult.Success)
                {
                @"Невдала спроба запису документу ""Приймання товару""!".WarningBox();
                }
        }
Ejemplo n.º 7
0
 private void Finish(bool isSaved, AcceptancePlan document)
 {
     goToStartPage();
 }