Beispiel #1
0
        //генерация рублевой квитанции
        protected void btUAPayRubles_Click(object sender, EventArgs e)
        {
            UAbonentDO      uaDO = new UAbonentDO();
            UOrderDO        uoDO = new UOrderDO();
            UOrder          uo;
            UAbonent        ua;
            UniversalEntity ue = new UniversalEntity();
            int             id = Convert.ToInt32(hfODID.Value);

            ue = uaDO.RetrieveByOrderID(id);

            UOrderDetailsDO uodDO    = new UOrderDetailsDO();
            double          sum      = 0;
            double          sumrub   = 0;
            double          nds      = 0;
            double          finalsum = 0;

            if (ue.Count > 0)
            {
                ua = (UAbonent)ue[0];
                ue = uoDO.RetrieveUOrderById(id);
                if (ue.Count > 0)
                {
                    uo = (UOrder)ue[0];
                    ue = uodDO.RetrieveUOrderDetailsByOrderID(id);
                    foreach (UOrderDetails uod in ue)
                    {
                        sum += uod.PriceRub;
                        // sumrub += (uod.Price) * 2;

                        /*sumrub = sum;
                         * nds = sumrub*0.2;
                         * nds = Math.Round(nds, 2);
                         * finalsum = (nds + sumrub) + (nds + sumrub);*/
                    }

                    using (DocX document = DocX.Load(Request.MapPath("~\\Templates/payua.docx")))
                    {
                        //DocXEntender.ReplaceFormatedText(document, "DDD", "дата");
                        document.ReplaceText("TITLE", ua.Title, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ADDRESS", ua.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("PHONE", ua.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DATE", DateTime.Now.ToString("dd MMMM yyyy"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NNN", uo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VIEW", uo.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);
                        //document.ReplaceText("CENA", sumrub.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //document.ReplaceText("NDS", Utilities.GetVATRubU(sumrub).ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VSEGO", sum.ToString("0.00"), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //VODOMER
                        document.SaveAs(Request.MapPath("~\\Templates/payrubles.docx"));
                        litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?uapayrub=Corporate\"></iframe>";
                    }
                }
            }
        }
Beispiel #2
0
        //Привязка данных в контрол
        public void Bind()
        {
            panEdit.Visible = false;
            panView.Visible = true;

            cbSeld.Checked = false;
            cbSeld.Enabled = true;
            cbPaid.Checked = false;
            cbPaid.Enabled = true;

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

            UniversalEntity ue   = new UniversalEntity();
            UOrder          uo   = new UOrder();
            UOrderDO        uodo = new UOrderDO();

            ue = uodo.RetrieveUOrderById(_OrderID);

            if (ue.Count > 0)
            {
                uo             = (UOrder)ue[0];
                hfDateIn.Value = uo.DateIn.ToShortDateString();
                if (uo.DateOut != null)
                {
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                }
                if (uo.IsPaid)
                {
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                    if (uo.PaymentDay.HasValue)
                    {
                        tbPaymentDay.Text = uo.PaymentDay.Value.ToShortDateString();
                    }
                    tbPaymentDay.Enabled = false;
                }
            }

            hfODID.Value        = _OrderID.ToString();
            litAbonentInfo.Text = GetAbonentInfo(_OrderID).ToString();
        }
Beispiel #3
0
        //Генерация договора
        protected void btContract_Click(object sender, EventArgs e)
        {
            UniversalEntity ue   = new UniversalEntity();
            UniversalEntity uev  = new UniversalEntity();
            int             id   = Convert.ToInt32(hfODID.Value);
            UAbonent        ua   = new UAbonent();
            UAbonentDO      uado = new UAbonentDO();

            ue = uado.RetrieveByOrderID(id);
            UOrderDetailsDO uoddo = new UOrderDetailsDO();
            VodomerTypeDO   vtdo  = new VodomerTypeDO();
            VodomerType     vt;
            UOrderDetails   uod;

            if (ue.Count > 0)
            {
                double sum     = 0;
                double sumvat  = 0;
                string vodomer = string.Empty;
                ua = (UAbonent)ue[0];
                ue = uoddo.RetrieveUOrderDetailsByOrderID(id);
                if (ue.Count > 0)
                {
                    for (int i = 0; i < ue.Count; i++)
                    {
                        uod     = (UOrderDetails)ue[i];
                        sum    += uod.GetPriceWithVAT();
                        sumvat += uod.GetPriceVAT();
                        uev     = vtdo.RetrieveVodomerTypeByVodomerId(uod.VodomerID);
                        if (uev.Count > 0)
                        {
                            for (int j = 0; j < uev.Count; j++)
                            {
                                vt       = (VodomerType)uev[j];
                                vodomer += "Поверить " + vt.Description + " Ø " + vt.Diameter.ToString() + " мм  в количестве 1 шт.,  ";
                            }
                        }
                    }
                }
                UOrder   uo   = new UOrder();
                UOrderDO uoDO = new UOrderDO();
                ue = uoDO.RetrieveUOrderById(id);
                if (ue.Count > 0)
                {
                    uo = (UOrder)ue[0];
                }
                if (ua.IsBudget)
                {
                    //Для бюджетных организаций
                    using (DocX document = DocX.Load(Request.MapPath("~\\Templates/noncommerce.docx")))
                    {
                        //DocXExtender.ReplaceFormatedText(document, "DDD", "дата");
                        document.ReplaceText("NNN", uo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DATE", RuDateAndMoneyConverter.DateToTextLong(uo.DateIn) + " г.", false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("TITLE", ua.Title, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VODOMER", vodomer, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("SUM", RuDateAndMoneyConverter.CurrencyToTxt(sum, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NDS", RuDateAndMoneyConverter.CurrencyToTxt(sumvat, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("SSS", (sum).ToString("0.00") + " грн", false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("RS", ua.RS, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("BANK", ua.Bank, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("MFO", ua.MFO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("OKPO", ua.OKPO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ADDRESS", ua.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("FACE", ua.ContactFace, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("CAUSE", ua.Cause, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("PHONE", ua.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        //TAXTYPE
                        document.ReplaceText("TAXTYPE", ua.TaxType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);

                        //VODOMER
                        document.SaveAs(Request.MapPath("~\\Templates/outnoncommerce.docx"));
                        litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?Commerce=1\"></iframe>";
                    }
                }
                else
                {
                    //для небюджетных организаций
                    using (DocX document = DocX.Load(Request.MapPath("~\\Templates/commerce.docx")))
                    {
                        //DocXExtender.ReplaceFormatedText(document, "DDD", "дата");
                        document.ReplaceText("NNN", uo.ID.ToString(), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("DATE", RuDateAndMoneyConverter.DateToTextLong(uo.DateIn) + " г.", false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("TITLE", ua.Title, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("VODOMER", vodomer, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("SUM", RuDateAndMoneyConverter.CurrencyToTxt(sum, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("NDS", RuDateAndMoneyConverter.CurrencyToTxt(sumvat, true), false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("RS", ua.RS, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("BANK", ua.Bank, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("MFO", ua.MFO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("OKPO", ua.OKPO, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("ADDRESS", ua.Address, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("FACE", ua.ContactFace, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("CAUSE", ua.Cause, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("PHONE", ua.Phone, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                        document.ReplaceText("TAXTYPE", ua.TaxType, false, System.Text.RegularExpressions.RegexOptions.IgnoreCase);

                        //VODOMER
                        document.SaveAs(Request.MapPath("~\\Templates/outcommerce.docx"));
                        litScript.Text = "<iframe style=\"display:none;\" src=\"../GetDocument.ashx?Commerce=0\"></iframe>";
                    }
                }
            }
        }
Beispiel #4
0
        public static void GenerateBill(int id)
        {
            InitializeWorkbookBill();

            ISheet sheet1 = hssfworkbook.GetSheet("s");


            UniversalEntity ue = new UniversalEntity();
            //UniversalEntity uev = new UniversalEntity();

            UAbonent        ua    = new UAbonent();
            UAbonentDO      uado  = new UAbonentDO();
            UOrder          uo    = new UOrder();
            UOrderDO        uodo  = new UOrderDO();
            UOrderDetailsDO uodDO = new UOrderDetailsDO();

            ue = uado.RetrieveByOrderID(id);
            string header    = string.Empty;
            string actNumber = string.Empty;

            if (ue.Count > 0)
            {
                ua      = (UAbonent)ue[0];
                header += ua.Title + " \nюр адрес: " + ua.Address + " \n№ св. пл. НДС: " + ua.VATPay + " \n№ ИНН: " + ua.INN + " \nтел.: " + ua.Phone;
            }
            ue = uodo.RetrieveUOrderById(id);
            if (ue.Count > 0)
            {
                uo = (UOrder)ue[0];
                sheet1.GetRow(4).GetCell(GetLetterNumber("aj")).SetCellValue(uo.ID);
                sheet1.GetRow(9).GetCell(GetLetterNumber("ai")).SetCellValue(RuDateAndMoneyConverter.DateToTextLongUA(uo.DateIn) + "р.");
            }
            ue = uodDO.RetrieveUOrderDetailsByOrderID(id);
            sheet1.GetRow(16).GetCell(6).SetCellValue(header);



            int    count = ue.Count;
            double sum   = 0;
            int    row   = 20;

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

                        sheet1.GetRow(i).GetCell(GetLetterNumber("a")).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}, {1}, {2}", al[0].ToString(), al[1].ToString(), al[2].ToString()));
                        sheet1.GetRow(i).GetCell(GetLetterNumber("ad")).SetCellValue("шт.");
                        sheet1.GetRow(i).GetCell(GetLetterNumber("aj")).SetCellValue(al[4].ToString());
                        sheet1.GetRow(i).GetCell(GetLetterNumber("ap")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));
                        sheet1.GetRow(i).GetCell(GetLetterNumber("av")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));
                        sum += Convert.ToDouble(al[3]);
                    }
                }
            }
            else
            {
                CustomRetrieverDO crDO = new CustomRetrieverDO();
                ue = crDO.RetrieveUActByOrderID5High(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(GetLetterNumber("a")).SetCellValue(string.Format("Определения метрологических характеристик водомера  D{0}", al[0].ToString()));
                        sheet1.GetRow(i).GetCell(GetLetterNumber("ad")).SetCellValue("шт.");
                        sheet1.GetRow(i).GetCell(GetLetterNumber("aj")).SetCellValue(al[3].ToString());
                        sheet1.GetRow(i).GetCell(GetLetterNumber("ap")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));
                        sheet1.GetRow(i).GetCell(GetLetterNumber("av")).SetCellValue(Convert.ToDouble(al[3]).ToString("0.00"));

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

            /*int row = 20;
             * double sum = 0;
             *
             *
             *
             *
             *
             * if (ue.Count > 0)
             * {
             *  for (int i = row; i < ue.Count + row; i++)
             *  {
             *      UOrderDetails u = (UOrderDetails)ue[i - row];
             *
             *      sheet1.GetRow(i).GetCell(GetLetterNumber("a")).SetCellValue("Определения метрологических характеристик водомера ");
             *      sheet1.GetRow(i).GetCell(GetLetterNumber("ad")).SetCellValue("шт.");
             *      sheet1.GetRow(i).GetCell(GetLetterNumber("aj")).SetCellValue("1");
             *      sheet1.GetRow(i).GetCell(GetLetterNumber("ap")).SetCellValue(u.Price.ToString("0.00"));
             *      sheet1.GetRow(i).GetCell(GetLetterNumber("av")).SetCellValue(u.Price.ToString("0.00"));
             *      sum += u.Price;
             *  }
             * }*/
            sheet1.GetRow(31).GetCell(GetLetterNumber("av")).SetCellValue(sum.ToString("0.00"));
            sheet1.GetRow(32).GetCell(GetLetterNumber("av")).SetCellValue(Utilities.GetVAT(sum).ToString("0.00"));
            sheet1.GetRow(33).GetCell(GetLetterNumber("av")).SetCellValue((sum + Utilities.GetVAT(sum)).ToString("0.00"));
            sheet1.GetRow(35).GetCell(GetLetterNumber("a")).SetCellValue("Загальна сума, що підлягає оплаті: " + UADateAndMoneyConverter.CurrencyToTxt((sum + Utilities.GetVAT(sum)), true));
            //Загальна сума, що підлягає оплаті


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

            WriteToFileB();
        }
Beispiel #5
0
        public static void GenerateUAct(int id)
        {
            UniversalEntity ue    = new UniversalEntity();
            UAbonent        ua    = new UAbonent();
            UAbonentDO      uado  = new UAbonentDO();
            UOrder          uo    = new UOrder();
            UOrderDO        uodo  = new UOrderDO();
            UOrderDetailsDO uodDO = new UOrderDetailsDO();

            ue = uado.RetrieveByOrderID(id);
            string header    = string.Empty;
            string actNumber = string.Empty;

            if (ue.Count > 0)
            {
                ua      = (UAbonent)ue[0];
                header += ua.Title + " \nюр адрес: " + ua.Address + " \n№ св. пл. НДС: " + ua.VATPay + " \n№ ИНН: " + ua.INN + " \nтел.: " + ua.Phone;
            }
            ue = uodo.RetrieveUOrderById(id);
            if (ue.Count > 0)
            {
                uo = (UOrder)ue[0];
                if (uo.DateOut.HasValue)
                {
                    actNumber = "  г. Донецк            АКТ № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г.";
                }
                else
                {
                    actNumber = "  г. Донецк            АКТ № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г.";
                }
            }

            ue = uodDO.RetrieveUOrderDetailsByOrderID(id);

            InitializeWorkbook();

            ISheet sheet1 = hssfworkbook.GetSheet("s");

            sheet1.GetRow(11).GetCell(0).SetCellValue("                             по договору (письму) № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г.");

            sheet1.GetRow(41).GetCell(0).SetCellValue("                             по договору (письму) № " + uo.ID + " от ____________________" + DateTime.Now.Year.ToString() + " г.");

            //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);

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

            int count = ue.Count;

            if (count <= 5)
            {
                CustomRetrieverDO crDO = new CustomRetrieverDO();
                ue = crDO.RetrieveUActByOrderID5Low(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.RetrieveUActByOrderID5High(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++;
                    }
                }
            }



            /*int rowC = 44;
             * int row = 14;
             * double sum = 0;
             * if (ue.Count > 0)
             * {
             *  for (int i = row; i < ue.Count + row; i++)
             *  {
             *      UOrderDetails u = (UOrderDetails)ue[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("1");
             *      sheet1.GetRow(i).GetCell(5).SetCellValue(u.Price.ToString("0.00"));
             *      sheet1.GetRow(i).GetCell(6).SetCellValue(u.Price.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("1");
             *      sheet1.GetRow(rowC).GetCell(5).SetCellValue(u.Price.ToString("0.00"));
             *      sheet1.GetRow(rowC).GetCell(6).SetCellValue(u.Price.ToString("0.00"));
             *
             *      sum += u.Price;
             *      rowC++;
             *  }
             * }*/

            sheet1.GetRow(19).GetCell(6).SetCellValue(sum.ToString("0.00"));
            sheet1.GetRow(20).GetCell(6).SetCellValue(Utilities.GetVAT(sum).ToString("0.00"));
            sheet1.GetRow(21).GetCell(6).SetCellValue((sum + Utilities.GetVAT(sum)).ToString("0.00"));

            sheet1.GetRow(49).GetCell(6).SetCellValue(sum.ToString("0.00"));
            sheet1.GetRow(50).GetCell(6).SetCellValue(Utilities.GetVAT(sum).ToString("0.00"));
            sheet1.GetRow(51).GetCell(6).SetCellValue((sum + Utilities.GetVAT(sum)).ToString("0.00"));

            /* sheet1.GetRow(2).GetCell(1).SetCellValue(300);
            *  sheet1.GetRow(3).GetCell(1).SetCellValue(500050);
            *  sheet1.GetRow(4).GetCell(1).SetCellValue(8000);
            *  sheet1.GetRow(5).GetCell(1).SetCellValue(110);
            *  sheet1.GetRow(6).GetCell(1).SetCellValue(100);
            *  sheet1.GetRow(7).GetCell(1).SetCellValue(200);
            *  sheet1.GetRow(8).GetCell(1).SetCellValue(210);
            *  sheet1.GetRow(9).GetCell(1).SetCellValue(2300);
            *  sheet1.GetRow(10).GetCell(1).SetCellValue(240);
            *  sheet1.GetRow(11).GetCell(1).SetCellValue(180123);
            *  sheet1.GetRow(12).GetCell(1).SetCellValue(150);*/

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

            WriteToFile();
        }
Beispiel #6
0
        //Привязка данных в контрол
        public void Bind()
        {
            User u = GetCurrentUser();

            u.GetPermissions();

            /*if (u.ChekPermission("littlewdk"))
             * {
             *  btActRublesForLittleWdk.Visible = true;
             *  btBillRublesForLittleWDK.Visible = true;
             *  btUAPayRublesForLittleWDK.Visible = true;
             * }
             * else
             * {
             *  btActRublesForLittleWdk.Visible = false;
             *  btBillRublesForLittleWDK.Visible = false;
             *  btUAPayRublesForLittleWDK.Visible = false;
             * }*/


            panEdit.Visible = false;
            panView.Visible = true;

            cbSeld.Checked = false;
            cbSeld.Enabled = true;
            cbPaid.Checked = false;
            cbPaid.Enabled = true;

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

            UniversalEntity ue   = new UniversalEntity();
            UOrder          uo   = new UOrder();
            UOrderDO        uodo = new UOrderDO();

            ue = uodo.RetrieveUOrderById(_OrderID);

            if (ue.Count > 0)
            {
                uo             = (UOrder)ue[0];
                hfDateIn.Value = uo.DateIn.ToShortDateString();
                if (uo.DateOut != null)
                {
                    cbSeld.Checked = true;
                    cbSeld.Enabled = false;
                }
                if (uo.IsPaid)
                {
                    cbPaid.Checked = true;
                    cbPaid.Enabled = false;
                    if (uo.PaymentDay.HasValue)
                    {
                        tbPaymentDay.Text = uo.PaymentDay.Value.ToShortDateString();
                    }
                    tbPaymentDay.Enabled = false;
                }
            }

            hfODID.Value        = _OrderID.ToString();
            litAbonentInfo.Text = GetAbonentInfo(_OrderID).ToString();
        }