Esempio n. 1
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();
                FAbonent        fa   = new FAbonent();
                FAbonentDO      fado = new FAbonentDO();
                ue = fado.RetrieveByOrderID(_OrderID);
                if (ue.Count > 0)
                {
                    fa                        = (FAbonent)ue[0];
                    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;
                }
            }
            else
            {
                punAdonentEditor.Visible = false;
                gvJournal.Visible        = true;
                gvJournal2.Visible       = false;
            }
        }
Esempio n. 2
0
        protected void radbutSaveAbonentInfo_Click(object sender, EventArgs e)
        {
            UniversalEntity ue   = new UniversalEntity();
            FAbonent        fa   = new FAbonent();
            FAbonentDO      fado = new FAbonentDO();

            ue = fado.RetrieveByOrderID(Utilities.ConvertToInt(hfODID.Value));
            if (ue.Count > 0)
            {
                fa            = (FAbonent)ue[0];
                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;
                fado.Update(fa, GetCurrentUser().ID);
            }



            _OrderID = Utilities.ConvertToInt(hfODID.Value);
            Bind();
        }
Esempio n. 3
0
    public string CitySuggest(string tryValue, string[] additionalParams)
    {
        List <SuggestionItem> items   = new List <SuggestionItem>();
        List <string>         surname = new List <string>();
        FAbonent        fa            = new FAbonent();
        FAbonentDO      fado          = new FAbonentDO();
        UniversalEntity ue            = new UniversalEntity();

        ue = fado.RetrieveLikeSurname(tryValue);
        if (ue.Count > 0)
        {
            for (int i = 0; i < ue.Count; i++)
            {
                fa = (FAbonent)ue[i];
                //create SuggestionItem
                SuggestionItem suggestionItem = new SuggestionItem();
                suggestionItem.Title       = fa.Surname;
                suggestionItem.Description = SuggestionTools.HighLight(fa.FirstName + " " + fa.LastName, tryValue) + fa.ID.ToString();
                suggestionItem.Id          = fa.ID.ToString();
                //add item to the list
                items.Add(suggestionItem);
            }
        }
        //create result Item
        SuggestionResult suggestionResult = new SuggestionResult();

        suggestionResult.Items  = items.ToArray();
        suggestionResult.Header = new BasicSuggestionTemplate("Please select your city.");
        suggestionResult.Footer = new BasicSuggestionTemplate("Powered by ConvincingMail");
        return(suggestionResult.ToJSON(tryValue));
    }
Esempio n. 4
0
        //radbutDeleteAbonentInfo_Click
        protected void radbutDeleteAbonentInfo_Click(object sender, EventArgs e)
        {
            FAbonentDO fado = new FAbonentDO();

            fado.Delete(Utilities.ConvertToInt(hfODID.Value), GetCurrentUser().ID);
            _OrderID = Utilities.ConvertToInt(hfODID.Value);
            Bind();
        }
Esempio n. 5
0
        protected void btOrder_Check_Click(object sender, EventArgs e)
        {
            FAbonentDO      faDO = new FAbonentDO();
            FOrderDO        foDO = new FOrderDO();
            FOrder          fo;
            FAbonent        fa;
            UniversalEntity ue = new UniversalEntity();
            int             id = Convert.ToInt32(hfODID.Value);

            ue = faDO.RetrieveByOrderID(id);

            FOrderDetailsDO fodDO = new FOrderDetailsDO();
            //FOrderDetails fod;
            double sum = 0;

            if (ue.Count > 0)
            {
                fa = (FAbonent)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;
                    }
                    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", (sum + Utilities.GetVAT(sum)).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>";
                    }
                }
            }
        }
Esempio n. 6
0
        public static string[] GetCompletionList(string prefixText, int count, string contextKey)
        {
            List <string>   surname = new List <string>();
            FAbonent        fa      = new FAbonent();
            FAbonentDO      fado    = new FAbonentDO();
            UniversalEntity ue      = new UniversalEntity();

            ue = fado.RetrieveLikeSurname(prefixText);
            if (ue.Count > 0)
            {
                for (int i = 0; i < ue.Count; i++)
                {
                    fa = (FAbonent)ue[i];
                    surname.Add(fa.Surname);
                }
            }
            return(surname.ToArray());
        }
Esempio n. 7
0
        protected void btOrder_Click(object sender, EventArgs e)
        {
            FAbonentDO      faDO = new FAbonentDO();
            FAbonent        fa;
            UniversalEntity ue = new UniversalEntity();
            int             id = Convert.ToInt32(hfODID.Value);

            ue = faDO.RetrieveByOrderID(id);
            if (ue.Count > 0)
            {
                fa = (FAbonent)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>";
                }
            }
        }
Esempio n. 8
0
        //Сохранение в базу
        protected void lbSaveAll_Click(object sender, EventArgs e)
        {
            if (Session["Abonent"] != null)
            {
                SessionAbonent sa = (SessionAbonent)Session["Abonent"];
                if (sa.Vodomer.Count == 0)
                {
                    radWM.RadAlert("Необходимо добавить минимум 1 водомер.", null, null, "Предупреждение", "");
                }
                else
                {
                    if (sa.Type == (short)Abonent.Corporate)
                    {
                        UAbonent   ua   = sa.UAbon;
                        UAbonentDO uado = new UAbonentDO();
                        int        uid  = uado.Create(ua);
                        if (uid > 0)
                        {
                            sa.UAbon.ID        = uid;
                            Session["Abonent"] = sa;
                            UOrder   uo   = new UOrder();
                            UOrderDO uodo = new UOrderDO();
                            uo.ActionType = "Определения метрологических характеристик водомера";
                            uo.UAbonentID = uid;
                            uo.UserID     = GetCurrentUser().ID;

                            int uoid = uodo.Create(uo);
                            if (uoid > 0)
                            {
                                hfOrder.Value = uoid.ToString();
                                UOrderDetails   uod   = new UOrderDetails();
                                UOrderDetailsDO uoddo = new UOrderDetailsDO();
                                VodomerDO       vdo   = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create1(v);
                                    uod.UOrderID   = uoid;
                                    uod.VodomerID  = vid;
                                    uod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = uoddo.Create(uod);
                                }
                                Response.Redirect("UJournal.aspx?id=" + uoid.ToString());
                            }
                        }
                    }
                    if (sa.Type == (short)Abonent.Private)
                    {
                        FAbonent   fa   = sa.FAbon;
                        FAbonentDO fado = new FAbonentDO();
                        int        fid  = fado.Create(fa);
                        if (fid > 0)
                        {
                            sa.FAbon.ID        = fid;
                            Session["Abonent"] = sa;
                            FOrder   fo   = new FOrder();
                            FOrderDO fodo = new FOrderDO();
                            fo.ActionType = "Определения метрологических характеристик водомера ";
                            fo.FAbonentID = fid;
                            fo.UserID     = GetCurrentUser().ID;

                            int foid = fodo.Create(fo);
                            if (foid > 0)
                            {
                                hfOrder.Value = foid.ToString();
                                FOrderDetails   fod   = new FOrderDetails();
                                FOrderDetailsDO foddo = new FOrderDetailsDO();
                                VodomerDO       vdo   = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create1(v);
                                    fod.FOrderID   = foid;
                                    fod.VodomerID  = vid;
                                    fod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = foddo.Create(fod);
                                }
                                Response.Redirect("FJournal.aspx?id=" + foid.ToString());
                            }
                        }
                    }
                    // LoadStep3();
                }
            }
        }
Esempio n. 9
0
        //Сохранение в базу
        protected void lbSaveAll_Click(object sender, EventArgs e)
        {
            if (Session["Abonent"] != null)
            {
                SessionAbonent sa = (SessionAbonent)Session["Abonent"];
                if (sa.Vodomer.Count == 0)
                {
                    SetMessege("Предупреждение", "Необходимо добавить минимум 1 водомер.");
                }
                else
                {
                    if (sa.Type == (short)Abonent.Corporate)
                    {
                        UAbonent   ua   = sa.UAbon;
                        UAbonentDO uado = new UAbonentDO();
                        int        uid  = uado.Create(ua);
                        if (uid > 0)
                        {
                            sa.UAbon.ID        = uid;
                            Session["Abonent"] = sa;
                            UOrder   uo   = new UOrder();
                            UOrderDO uodo = new UOrderDO();
                            uo.ActionType = "Поверка водомера.";
                            uo.UAbonentID = uid;
                            uo.UserID     = GetCurrentUser().ID;

                            int uoid = uodo.Create(uo);
                            if (uoid > 0)
                            {
                                hfOrder.Value = uoid.ToString();
                                UOrderDetails   uod   = new UOrderDetails();
                                UOrderDetailsDO uoddo = new UOrderDetailsDO();
                                VodomerDO       vdo   = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create(v);
                                    uod.UOrderID   = uoid;
                                    uod.VodomerID  = vid;
                                    uod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = uoddo.Create(uod);
                                }
                            }
                        }
                    }
                    if (sa.Type == (short)Abonent.Private)
                    {
                        FAbonent   fa   = sa.FAbon;
                        FAbonentDO fado = new FAbonentDO();
                        int        fid  = fado.Create(fa);
                        if (fid > 0)
                        {
                            sa.FAbon.ID        = fid;
                            Session["Abonent"] = sa;
                            FOrder   fo   = new FOrder();
                            FOrderDO fodo = new FOrderDO();
                            fo.ActionType = "Поверка водомера.";
                            fo.FAbonentID = fid;
                            fo.UserID     = GetCurrentUser().ID;

                            int foid = fodo.Create(fo);
                            if (foid > 0)
                            {
                                hfOrder.Value = foid.ToString();
                                FOrderDetails   fod   = new FOrderDetails();
                                FOrderDetailsDO foddo = new FOrderDetailsDO();
                                VodomerDO       vdo   = new VodomerDO();
                                foreach (Vodomer v in sa.Vodomer)
                                {
                                    int vid = vdo.Create(v);
                                    fod.FOrderID   = foid;
                                    fod.VodomerID  = vid;
                                    fod.StartValue = v.VodomerPreview.StartValue;
                                    int uodid = foddo.Create(fod);
                                }
                            }
                        }
                    }
                    //SetMessege("Статус", "Абонент и водомер успешно внесены в базу.");
                    LoadStep3();
                }
            }
        }
Esempio n. 10
0
        public void Bind()
        {
            cbSeld.Checked = false;
            cbSeld.Enabled = true;
            cbPaid.Checked = false;
            cbPaid.Enabled = true;


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

            FOrder          fo   = new FOrder();
            FOrderDO        fodo = new FOrderDO();
            UniversalEntity ue   = new UniversalEntity();

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

                /*if (!fo.IsPaid)
                 * {
                 *  btAct.Visible = false;
                 * }
                 * else
                 * {
                 *  btAct.Visible = true;
                 * }*/
                if (fo.DateOut != null)
                {
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                }
                if (fo.IsPaid)
                {
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                    if (fo.PaymentDay.HasValue)
                    {
                        tbPaymentDay.Text = fo.PaymentDay.Value.ToShortDateString();
                    }
                    tbPaymentDay.Enabled = false;
                }
            }

            hfODID.Value = _OrderID.ToString();
            StringBuilder sb   = new StringBuilder();
            FAbonent      fa   = new FAbonent();
            FAbonentDO    fado = new FAbonentDO();

            ue = fado.RetrieveByOrderID(_OrderID);
            if (ue.Count > 0)
            {
                fa = (FAbonent)ue[0];
                sb.AppendLine("<span>ФИО: " + fa.Surname + " " + fa.FirstName + " " + fa.LastName + "</span><br/>");
                sb.AppendLine("<span>Тел.: " + fa.Phone + "</span><br/>");
                sb.AppendLine("<span>Адрес: " + fa.Address + "</span><br/>");
                if (fa.NotPay)
                {
                    sb.AppendLine("<span>Без оплаты</span><br/>");
                }

                litAbonentInfo.Text = sb.ToString();
            }
        }
Esempio n. 11
0
        //генерация квитнации
        protected void btPay_Click(object sender, EventArgs e)
        {
            FAbonentDO      faDO = new FAbonentDO();
            FOrderDO        foDO = new FOrderDO();
            VodomerType     vt   = new VodomerType();
            FOrder          fo;
            FAbonent        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; //рублевая итоговая сумма

            if (ue.Count > 0)
            {
                fa = (FAbonent)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("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>";
                    }
                }
            }
        }
Esempio n. 12
0
        public static void GenerateFActSpecial(int id, int ULocationID)
        {
            UniversalEntity ue         = new UniversalEntity();
            string          header     = string.Empty;
            string          actNumber  = string.Empty;
            string          actNumber2 = string.Empty;

            FAbonentDO faDO = new FAbonentDO();

            ue = faDO.RetrieveByOrderID(id);
            FAbonent fa = new FAbonent();

            if (ue.Count > 0)
            {
                fa      = (FAbonent)ue[0];
                header += fa.Surname + " " + fa.FirstName + " " + fa.LastName + " \nадрес: " + fa.Address + "\nтел.: " + fa.Phone;
            }

            FOrder          fo    = new FOrder();
            FOrderDO        foDO  = new FOrderDO();
            FOrderDetailsDO fodDO = new FOrderDetailsDO();


            ue = foDO.RetrieveFOrderById(id);
            if (ue.Count > 0)
            {
                fo         = (FOrder)ue[0];
                actNumber  = "  г. Донецк            АКТ № " + fo.Prefix + fo.ID + " от ____________________" /*+ RuDateAndMoneyConverter.DateToTextLong(fo.DateIn)*/ + " г.";
                actNumber2 = "                             по договору (письму) №  " + fo.Prefix + fo.ID + " от ____________________" + /*RuDateAndMoneyConverter.DateToTextLong(fo.DateIn) +*/ " г.";
            }

            ue = fodDO.RetrieveFOrderDetailsByOrderID(id);

            InitializeWorkbookFActSpecial(); //InitializeWorkbook();
            ISheet sheet1 = hssfworkbook.GetSheet("s");

            //create cell on rows, since rows do already exist,it's not necessary to create rows again.
            sheet1.GetRow(2).GetCell(3).SetCellValue(header);
            sheet1.GetRow(32).GetCell(3).SetCellValue(header);
            sheet1.GetRow(9).GetCell(0).SetCellValue(actNumber);
            sheet1.GetRow(39).GetCell(0).SetCellValue(actNumber);
            sheet1.GetRow(11).GetCell(0).SetCellValue(actNumber2);
            //sheet1.GetRow(41).GetCell(0).SetCellValue(actNumber2);

            int    rowC = 44;
            int    row  = 14;
            double sum  = 0;

            int count = ue.Count;

            if (count <= 5)
            {
                CustomRetrieverDO crDO = new CustomRetrieverDO();
                ue = crDO.RetrieveFActByOrderID5Low(id);
                if (ue.Count > 0)
                {
                    for (int i = row; i < ue.Count + row; i++)
                    {
                        ArrayList al = (ArrayList)ue[i - row];
                        //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row];

                        sheet1.GetRow(i).GetCell(0).SetCellValue(i - row + 1);
                        sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString()));
                        sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция");
                        sheet1.GetRow(i).GetCell(3).SetCellValue("шт.");
                        sheet1.GetRow(i).GetCell(4).SetCellValue(al[4].ToString());
                        sheet1.GetRow(i).GetCell(5).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));
                        sheet1.GetRow(i).GetCell(6).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));


                        sum += Convert.ToDouble(al[3]);
                        rowC++;
                    }
                }
            }
            else
            {
                CustomRetrieverDO crDO = new CustomRetrieverDO();
                ue = crDO.RetrieveFActByOrderID5High(id);
                if (ue.Count > 0)
                {
                    for (int i = row; i < ue.Count + row; i++)
                    {
                        ArrayList al = (ArrayList)ue[i - row];
                        //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row];

                        sheet1.GetRow(i).GetCell(0).SetCellValue(i - row + 1);
                        sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}", al[0].ToString()));
                        sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция");
                        sheet1.GetRow(i).GetCell(3).SetCellValue("шт.");
                        sheet1.GetRow(i).GetCell(4).SetCellValue(al[3].ToString());
                        sheet1.GetRow(i).GetCell(5).SetCellValue(Convert.ToDouble(al[1]).ToString("0.00"));
                        sheet1.GetRow(i).GetCell(6).SetCellValue(Convert.ToDouble(al[2]).ToString("0.00"));

                        sum += Convert.ToDouble(al[2]);
                        rowC++;
                    }
                }
            }
            sheet1.GetRow(19).GetCell(6).SetCellValue(sum.ToString("0.00"));
            sheet1.GetRow(20).GetCell(6).SetCellValue((sum / 100 * 20).ToString("0.00"));
            sheet1.GetRow(21).GetCell(6).SetCellValue((sum + (sum / 100 * 20)).ToString("0.00"));

            string tmp = string.Empty;

            tmp = sheet1.GetRow(29).GetCell(GetLetterNumber("c")).StringCellValue;

            string tmp1 = string.Empty;

            tmp1 = sheet1.GetRow(41).GetCell(GetLetterNumber("a")).StringCellValue;

            CustomRetrieverDO crdo = new CustomRetrieverDO();

            ue = crdo.RetrieveUserLocation(ULocationID);
            if (ue.Count > 0)
            {
                tmp1 = tmp1.Replace("257-42-61", (ue[0] as ArrayList)[2].ToString());
            }

            //tmp1 = tmp1.Replace("257-42-61", "");


            tmp = tmp.Replace("FIO", fa.Surname + " " + fa.FirstName + " " + fa.LastName);
            tmp = tmp.Replace("ADDRESS", fa.Address);
            tmp = tmp.Replace("PNONE", fa.Phone);
            tmp = tmp.Replace("DATE", DateTime.Now.ToString("dd MMMM yyyy"));
            tmp = tmp.Replace("NUMBER", fo.Prefix + fo.ID.ToString());
            tmp = tmp.Replace("TYPE", fo.ActionType);
            //tmp = tmp.Replace("SUM", sum.ToString("0.00"));
            //tmp = tmp.Replace("VAT", Utilities.GetVAT(sum).ToString("0.00"));
            tmp = tmp.Replace("ALL", (sum + Utilities.GetVAT(sum)).ToString("0.00"));



            sheet1.GetRow(41).GetCell(GetLetterNumber("a")).SetCellValue(tmp1);
            sheet1.GetRow(29).GetCell(GetLetterNumber("c")).SetCellValue(tmp);
            sheet1.GetRow(41).GetCell(GetLetterNumber("c")).SetCellValue(tmp);

            /*sheet1.GetRow(49).GetCell(6).SetCellValue(sum.ToString("0.00"));
             * sheet1.GetRow(50).GetCell(6).SetCellValue((sum / 100 * 20).ToString("0.00"));
             * sheet1.GetRow(51).GetCell(6).SetCellValue((sum + (sum / 100 * 20)).ToString("0.00"));*/

            //Force excel to recalculate all the formula while open
            sheet1.ForceFormulaRecalculation = true;

            WriteToFileFSpecial();
        }
Esempio n. 13
0
        public static void GenerateFAct(int id)
        {
            UniversalEntity ue         = new UniversalEntity();
            string          header     = string.Empty;
            string          actNumber  = string.Empty;
            string          actNumber2 = string.Empty;

            FAbonentDO faDO = new FAbonentDO();

            ue = faDO.RetrieveByOrderID(id);
            if (ue.Count > 0)
            {
                FAbonent fa = (FAbonent)ue[0];
                header += fa.Surname + " " + fa.FirstName + " " + fa.LastName + " \nадрес: " + fa.Address + "\nтел.: " + fa.Phone;
            }

            FOrder          fo    = new FOrder();
            FOrderDO        foDO  = new FOrderDO();
            FOrderDetailsDO fodDO = new FOrderDetailsDO();

            ue = foDO.RetrieveFOrderById(id);
            if (ue.Count > 0)
            {
                fo         = (FOrder)ue[0];
                actNumber  = "  г. Донецк            АКТ № " + fo.Prefix + fo.ID + " от " + RuDateAndMoneyConverter.DateToTextLong(fo.DateIn) + " г.";
                actNumber2 = "                             по договору (письму) №  " + fo.Prefix + fo.ID + " от " + RuDateAndMoneyConverter.DateToTextLong(fo.DateIn) + " г.";
            }

            ue = fodDO.RetrieveFOrderDetailsByOrderID(id);

            InitializeWorkbookFAct(); //InitializeWorkbook();
            ISheet sheet1 = hssfworkbook.GetSheet("s");

            //create cell on rows, since rows do already exist,it's not necessary to create rows again.
            sheet1.GetRow(2).GetCell(3).SetCellValue(header);
            sheet1.GetRow(32).GetCell(3).SetCellValue(header);
            sheet1.GetRow(9).GetCell(0).SetCellValue(actNumber);
            sheet1.GetRow(39).GetCell(0).SetCellValue(actNumber);
            sheet1.GetRow(11).GetCell(0).SetCellValue(actNumber2);
            sheet1.GetRow(41).GetCell(0).SetCellValue(actNumber2);

            int    rowC = 44;
            int    row  = 14;
            double sum  = 0;

            int count = ue.Count;

            if (count <= 5)
            {
                CustomRetrieverDO crDO = new CustomRetrieverDO();
                ue = crDO.RetrieveFActByOrderID5Low(id);
                if (ue.Count > 0)
                {
                    for (int i = row; i < ue.Count + row; i++)
                    {
                        ArrayList al = (ArrayList)ue[i - row];
                        //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row];

                        sheet1.GetRow(i).GetCell(0).SetCellValue(i - row + 1);
                        sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString()));
                        sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция");
                        sheet1.GetRow(i).GetCell(3).SetCellValue("шт.");
                        sheet1.GetRow(i).GetCell(4).SetCellValue(al[4].ToString());
                        sheet1.GetRow(i).GetCell(5).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));
                        sheet1.GetRow(i).GetCell(6).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));


                        sheet1.GetRow(rowC).GetCell(0).SetCellValue(i - row + 1);
                        sheet1.GetRow(rowC).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString()));
                        sheet1.GetRow(rowC).GetCell(2).SetCellValue("калькуляция");
                        sheet1.GetRow(rowC).GetCell(3).SetCellValue("шт.");
                        sheet1.GetRow(rowC).GetCell(4).SetCellValue(al[4].ToString());
                        sheet1.GetRow(rowC).GetCell(5).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));
                        sheet1.GetRow(rowC).GetCell(6).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));

                        sum += Convert.ToDouble(al[3]);
                        rowC++;
                    }
                }
            }
            else
            {
                CustomRetrieverDO crDO = new CustomRetrieverDO();
                ue = crDO.RetrieveFActByOrderID5High(id);
                if (ue.Count > 0)
                {
                    for (int i = row; i < ue.Count + row; i++)
                    {
                        ArrayList al = (ArrayList)ue[i - row];
                        //FOrderDetailsAct u = (FOrderDetailsAct)fodal[i - row];

                        sheet1.GetRow(i).GetCell(0).SetCellValue(i - row + 1);
                        sheet1.GetRow(i).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}", al[0].ToString()));
                        sheet1.GetRow(i).GetCell(2).SetCellValue("калькуляция");
                        sheet1.GetRow(i).GetCell(3).SetCellValue("шт.");
                        sheet1.GetRow(i).GetCell(4).SetCellValue(al[3].ToString());
                        sheet1.GetRow(i).GetCell(5).SetCellValue(Convert.ToDouble(al[1]).ToString("0.00"));
                        sheet1.GetRow(i).GetCell(6).SetCellValue(Convert.ToDouble(al[2]).ToString("0.00"));


                        sheet1.GetRow(rowC).GetCell(0).SetCellValue(i - row + 1);
                        sheet1.GetRow(rowC).GetCell(1).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}", al[0].ToString()));
                        sheet1.GetRow(rowC).GetCell(2).SetCellValue("калькуляция");
                        sheet1.GetRow(rowC).GetCell(3).SetCellValue("шт.");
                        sheet1.GetRow(rowC).GetCell(4).SetCellValue(al[3].ToString());
                        sheet1.GetRow(rowC).GetCell(5).SetCellValue(Convert.ToDouble(al[1]).ToString("0.00"));
                        sheet1.GetRow(rowC).GetCell(6).SetCellValue(Convert.ToDouble(al[2]).ToString("0.00"));

                        sum += Convert.ToDouble(al[2]);
                        rowC++;
                    }
                }
            }



            sheet1.GetRow(19).GetCell(6).SetCellValue(sum.ToString("0.00"));
            sheet1.GetRow(20).GetCell(6).SetCellValue((sum / 100 * 20).ToString("0.00"));
            sheet1.GetRow(21).GetCell(6).SetCellValue((sum + (sum / 100 * 20)).ToString("0.00"));

            sheet1.GetRow(49).GetCell(6).SetCellValue(sum.ToString("0.00"));
            sheet1.GetRow(50).GetCell(6).SetCellValue((sum / 100 * 20).ToString("0.00"));
            sheet1.GetRow(51).GetCell(6).SetCellValue((sum + (sum / 100 * 20)).ToString("0.00"));

            //Force excel to recalculate all the formula while open
            sheet1.ForceFormulaRecalculation = true;

            WriteToFileF();
        }
Esempio n. 14
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();


            FOrder   fo   = new FOrder();
            FOrderDO fodo = new FOrderDO();
            //StringBuilder sbl = new StringBuilder();
            UniversalEntity ue = new UniversalEntity();

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

                /*if (!fo.IsPaid)
                 * {
                 *  btAct.Visible = false;
                 * }
                 * else
                 * {
                 *  btAct.Visible = true;
                 * }*/
                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();
            FAbonent      fa   = new FAbonent();
            FAbonentDO    fado = new FAbonentDO();

            ue = fado.RetrieveByOrderID(_OrderID);
            if (ue.Count > 0)
            {
                fa = (FAbonent)ue[0];
                if (fa.NotPay)
                {
                    cbPaid.Enabled   = false;
                    btActRub.Enabled = false;
                    //btPay.Enabled = false;
                    //btOrder.Enabled = false;
                    //btOrderCheck.Enabled = false;
                    btActCheckRub.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/>");
                }



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