예제 #1
0
        protected void radbutSaveAbonentInfo_Click(object sender, EventArgs e)
        {
            UniversalEntity ue   = new UniversalEntity();
            NewFAbonent     fa   = new NewFAbonent();
            NewFAbonentDO   fado = new NewFAbonentDO();

            ue = fado.RetrieveByOrderID(Utilities.ConvertToInt(hfODID.Value));
            if (ue.Count > 0)
            {
                fa = (NewFAbonent)ue[0];
                fa.PhysicalNumberJournal = tbNumberJournalPhysical.Text;
                fa.Address    = tbAddress.Text;
                fa.Surname    = tbClientSurname.Text;
                fa.DistrictID = Utilities.ConvertToInt(ddlDistrict.SelectedValue);
                fa.FirstName  = tbClientName.Text;
                fa.LastName   = tbClientLastName.Text;
                fa.Phone      = tbPhone.Text;
                fa.NotPay     = cbNotPay.Checked;
                //fa.RejectVodomer = cbRejectVodomer.Checked;
                fado.Update(fa, GetCurrentUser().ID);
            }



            _OrderID = Utilities.ConvertToInt(hfODID.Value);
            Bind();
        }
예제 #2
0
        public void EditorMode()
        {
            User u = GetCurrentUser();

            u.GetPermissions();
            //проверяем наличие прав для редактировнаия
            if (u.ChekPermission("Editor"))
            {
                punAdonentEditor.Visible = true;
                gvJournal.Visible        = false;
                gvJournal2.Visible       = true;
                BindDistricts();
                UniversalEntity ue   = new UniversalEntity();
                NewFAbonent     fa   = new NewFAbonent();
                NewFAbonentDO   fado = new NewFAbonentDO();
                ue = fado.RetrieveByOrderID(_OrderID);
                if (ue.Count > 0)
                {
                    fa = (NewFAbonent)ue[0];
                    tbNumberJournalPhysical.Text = fa.PhysicalNumberJournal;
                    tbAddress.Text            = fa.Address;
                    tbClientSurname.Text      = fa.Surname;
                    ddlDistrict.SelectedValue = fa.DistrictID.ToString();
                    tbClientName.Text         = fa.FirstName;
                    tbClientLastName.Text     = fa.LastName;
                    tbPhone.Text     = fa.Phone;
                    cbNotPay.Checked = fa.NotPay;
                    //cbRejectVodomer.Checked = fa.RejectVodomer;
                }
                NewFOrder   fo    = new NewFOrder();
                NewFOrderDO fodDO = new NewFOrderDO();
                ue = fodDO.RetrieveFOrderById(_OrderID);
                if (ue.Count > 0)
                {
                    fo = (NewFOrder)ue[0];
                    cbDefectVodomer.Checked = fo.DefectVodomer;
                }
            }
            else
            {
                punAdonentEditor.Visible = false;
                gvJournal.Visible        = true;
                gvJournal2.Visible       = false;
            }
        }
예제 #3
0
        protected void btOrder_Click(object sender, EventArgs e)
        {
            NewFAbonentDO   faDO = new NewFAbonentDO();
            NewFAbonent     fa;
            UniversalEntity ue = new UniversalEntity();
            int             id = Convert.ToInt32(hfODID.Value);

            ue = faDO.RetrieveByOrderID(id);
            if (ue.Count > 0)
            {
                fa = (NewFAbonent)ue[0];
                using (DocX document = DocX.Load(Request.MapPath("~\\Templates/order.docx")))
                {
                    //DocXExtender.ReplaceFormatedText(document, "DDD", "дата");
                    document.ReplaceText("FIO", fa.Surname + " " + fa.FirstName + " " + fa.LastName, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    document.ReplaceText("ADDRESS", fa.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    document.ReplaceText("PNONE", fa.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    document.ReplaceText("DATE", DateTime.Now.ToString("dd MMMM yyyy"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                    //VODOMER
                    document.SaveAs(Request.MapPath("~\\Templates/outorder.docx"));
                    litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?order=1\"></iframe>";
                }
            }
        }
예제 #4
0
        protected void btOrder_Check_Click(object sender, EventArgs e)
        {
            NewFAbonentDO   faDO = new NewFAbonentDO();
            FOrderDO        foDO = new FOrderDO();
            FOrder          fo;
            NewFAbonent     fa;
            UniversalEntity ue = new UniversalEntity();
            int             id = Convert.ToInt32(hfODID.Value);

            ue = faDO.RetrieveByOrderID(id);

            FOrderDetailsDO fodDO = new FOrderDetailsDO();
            //FOrderDetails fod;
            double sum       = 0; //гривневая цена
            double getvat    = 0; //гривневый ндс
            double uafin     = 0; //гривневая итоговая сумма
            double sumrub    = 0; //рублевая цена
            double getvatrub = 0; //рублвый ндс
            double finish    = 0; //рублевая итоговая сумма

            //RetrieveFOrderByID (данные из FOrder + данные из NewFAbonent)
            if (ue.Count > 0)
            {
                fa = (NewFAbonent)ue[0];
                ue = foDO.RetrieveFOrderById(id);
                //RetrieveFOrderByID (данные из FOrder + данные из NewFAbonent)
                if (ue.Count > 0)
                {
                    fo = (FOrder)ue[0];

                    ue = fodDO.RetrieveFOrderDetailsByOrderID(id);
                    //цикл с RetrieveFOrderDetailsByOrderID (данные из FOrderDetails + данные из FOrder)
                    foreach (FOrderDetails fod in ue)
                    {
                        //гривневый счет
                        sum   += fod.Price;
                        getvat = sum * 0.2;
                        uafin  = (sum + getvat);
                        //рублевый счет
                        sumrub   += fod.Price;
                        getvatrub = sumrub * 0.2;
                        finish    = (sumrub + getvatrub) + (sumrub + getvatrub);
                    }
                    using (DocX document = DocX.Load(Request.MapPath("~\\Templates/order_check.docx")))
                    {
                        //DocXExtender.ReplaceFormatedText(document, "DDD", "дата");
                        document.ReplaceText("FIO", fa.Surname + " " + fa.FirstName + " " + fa.LastName, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ADDRESS", fa.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("PNONE", fa.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DATE", DateTime.Now.ToString("dd MMMM yyyy"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NUMBER", fo.Prefix + fo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("TYPE", fo.ActionType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //  document.ReplaceText("SUM", sum.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //  document.ReplaceText("VAT", Utilities.GetVAT(sum).ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ALL", uafin.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //  document.ReplaceText("CENA", sumrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //   document.ReplaceText("NDS", (Utilities.GetVATRub(sumrub)).ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VSEGO", finish.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);


                        //VODOMER
                        document.SaveAs(Request.MapPath("~\\Templates/outorder_check.docx"));
                        litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?ordercheck=1\"></iframe>";
                    }
                }
            }
        }
예제 #5
0
        //генерация квитнации
        protected void btPay_Click(object sender, EventArgs e)
        {
            NewFAbonentDO   faDO = new NewFAbonentDO();
            FOrderDO        foDO = new FOrderDO();
            VodomerType     vt   = new VodomerType();
            FOrder          fo;
            NewFAbonent     fa;
            UniversalEntity ue = new UniversalEntity();
            int             id = Convert.ToInt32(hfODID.Value);

            ue = faDO.RetrieveByOrderID(id);

            Vodomer   vod   = new Vodomer();
            VodomerDO vodDO = new VodomerDO();

            FOrderDetailsDO fodDO = new FOrderDetailsDO();
            FOrderDetails   fods  = new FOrderDetails();
            //FOrderDetails fod;
            double sum       = 0; //гривневая цена
            double getvat    = 0; //гривневый ндс
            double uafin     = 0; //гривневая итоговая сумма
            double sumrub    = 0; //рублевая цена
            double getvatrub = 0; //рублевый ндс
            double finish    = 0; //рублевая итоговая сумма

            if (ue.Count > 0)
            {
                fa = (NewFAbonent)ue[0];
                ue = foDO.RetrieveFOrderById(id);
                if (ue.Count > 0)
                {
                    fo = (FOrder)ue[0];

                    ue = fodDO.RetrieveFOrderDetailsByOrderID(id);
                    foreach (FOrderDetails fod in ue)
                    {
                        //гривневый счет
                        sum   += fod.Price;
                        getvat = sum * 0.2;
                        getvat = Math.Round(getvat, 2);
                        uafin  = (sum + getvat);
                        //рублевый счет
                        sumrub   += fod.Price;
                        getvatrub = sumrub * 0.2;
                        getvatrub = Math.Round(getvatrub, 2);
                        finish    = (sumrub + getvatrub) + (sumrub + getvatrub);
                    }
                    using (DocX document = DocX.Load(Request.MapPath("~\\Templates/kvit.docx")))
                    {
                        //DocXExtender.ReplaceFormatedText(document, "DDD", "дата");
                        document.ReplaceText("FIO", fa.Surname + " " + fa.FirstName + " " + fa.LastName, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ADDRESS", fa.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("PNONE", fa.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DATE", DateTime.Now.ToString("dd MMMM yyyy"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NUMBER", fo.Prefix + fo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VIEW", fo.ActionType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DIAMETR", vt.Diameter.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NOMZAVOD", vod.FactoryNumber.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("SUM", sum.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VAT", getvat.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ALL", uafin.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("CENA", sumrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("NDS", getvatrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VSEGO", finish.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);


                        //VODOMER
                        document.SaveAs(Request.MapPath("~\\Templates/kvitfa.docx"));
                        litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?pay=Private\"></iframe>";
                    }
                }
            }
        }
예제 #6
0
        public void Bind()
        {
            EditorMode();
            cbSeld.Checked          = false;
            cbSeld.Enabled          = true;
            cbPaid.Checked          = false;
            cbPaid.Enabled          = true;
            cbRejectVodomer.Checked = false;
            cbRejectVodomer.Enabled = true;
            cbDefectVodomer.Checked = false;
            cbDefectVodomer.Enabled = true;


            tbPaymentDay.Enabled = true;
            tbPaymentDay.Text    = DateTime.Now.ToShortDateString();


            NewFOrder   fo   = new NewFOrder();
            NewFOrderDO fodo = new NewFOrderDO();
            //StringBuilder sbl = new StringBuilder();
            UniversalEntity ue = new UniversalEntity();

            ue = fodo.RetrieveFOrderById(_OrderID);
            if (ue.Count > 0)
            {
                fo = (NewFOrder)ue[0];

                if (fo.DateOut != null)
                {
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                }
                if (fo.IsPaid)
                {
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                    if (fo.PaymentDay.HasValue)
                    {
                        tbPaymentDay.Text = fo.PaymentDay.Value.ToShortDateString();
                    }
                    tbPaymentDay.Enabled = false;
                }
                if (fo.DefectVodomer)
                {
                    cbDefectVodomer.Checked = true;
                    cbDefectVodomer.Enabled = false;
                }
            }


            hfODID.Value = _OrderID.ToString();
            StringBuilder sb   = new StringBuilder();
            NewFAbonent   fa   = new NewFAbonent();
            NewFAbonentDO fado = new NewFAbonentDO();

            ue = fado.RetrieveByOrderID(_OrderID);
            if (ue.Count > 0)
            {
                fa = (NewFAbonent)ue[0];
                if (fa.NotPay)
                {
                    cbPaid.Enabled      = false;
                    btActRubNew.Enabled = false;
                    //btPay.Enabled = false;
                    //btOrder.Enabled = false;
                    //btOrderCheck.Enabled = false;
                    btNewActCheckRub.Enabled = false;
                    //btWithdrawalAct.Enabled = false;
                }
                sb.AppendLine("<span>ФИО: " + fa.Surname + " " + fa.FirstName + " " + fa.LastName + "</span><br/>");
                sb.AppendLine("<span>номер по журналу: " + fa.PhysicalNumberJournal + "</span><br/>");
                sb.AppendLine("<span>Тел.: " + fa.Phone + "</span><br/>");
                sb.AppendLine("<span>Адрес: " + fa.Address + "</span><br/>");
                if (fa.NotPay)
                {
                    sb.AppendLine("<span style=\"color:red;font-size:18px;\">Без оплаты</span><br/>");
                }



                litAbonentInfo2018.Text = sb.ToString();
            }
        }