Example #1
0
        private void CancelOrderById(int id)
        {
            DS       = new DataSet();
            billdata = new BillData();
            int flag     = 1;
            int CancelBy = GlobalInfo.Userid;
            int result   = billdata.CancelOrderById(id, flag, CancelBy, string.Empty);

            if (result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Order Cancelled Successfully";
                pnlError.Update();
                bindList();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Example #2
0
 private static void AddTitle(Document document, BillData bill)
 {
     document.Add(string.Format("Счет на оплату № {0} от {1}",
                                bill.Number,
                                bill.SaveDate.ToString("dd MMMM yyyy")).Phrase(TitleFont));
     Line(document);
 }
Example #3
0
        public ActionResult ExportToExcel()
        {
            var model = new BillData().ExportExcel();

            //var excel = model.Select(x => new { x.billID,x.name,x.createDate,x.totalMoney,x.billStatus,x.address,x.creditCard});
            foreach (var item in model)
            {
                switch (item.status)
                {
                case 0:
                    item.billStatus = "Chờ xác nhận";
                    break;

                case 1:
                    item.billStatus = "Chờ lấy hàng";
                    break;

                case 2:
                    item.billStatus = "Đang giao";
                    break;

                case 3:
                    item.billStatus = "Đã giao";
                    break;

                case 4:
                    item.billStatus = "Đã hủy";
                    break;

                case 5:
                    item.billStatus = "Trả hàng/Hoàn tiền";
                    break;
                }
            }
            DataTable dt = ToDataTable(model);

            dt.Columns.RemoveAt(1);
            dt.Columns.RemoveAt(4);
            dt.Columns[0].ColumnName = "Mã hóa đơn";
            dt.Columns[1].ColumnName = "Tên khách hàng";
            dt.Columns[2].ColumnName = "Ngày mua";
            dt.Columns[3].ColumnName = "Tổng tiền";
            dt.Columns[4].ColumnName = "Tình trạng";
            dt.Columns[5].ColumnName = "Địa chỉ";
            dt.Columns[6].ColumnName = "Số thẻ tín dụng";
            //Name of File
            string fileName = "HoaDon.xlsx";

            using (XLWorkbook wb = new XLWorkbook())
            {
                //Add DataTable in worksheet
                wb.Worksheets.Add(dt);
                using (MemoryStream stream = new MemoryStream())
                {
                    wb.SaveAs(stream);
                    //Return xlsx Excel File
                    return(File(stream.ToArray(), "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", fileName));
                }
            }
        }
Example #4
0
        private static void AddMoney(Document document, BillData bill)
        {
            var table = new PdfPTable(2)
            {
                WidthPercentage = 100
            };

            table.SetWidths(new[]
            {
                600, 120
            });
            table.DefaultCell.Border = Rectangle.NO_BORDER;

            var price    = (bill.Price * bill.EuroToRuble);
            var priceVat = GetPriceVAT(bill.VAT, price).ToString("N2");

            table.AddCell("Итого:".Phrase(BoldFont).RightCell().NoBorder());
            table.AddCell(price.ToString("N2").Phrase(BoldFont).RightCell().NoBorder());
            table.AddCell("В том числе НДС:".Phrase(BoldFont).RightCell().NoBorder());
            table.AddCell(priceVat.Phrase(BoldFont).RightCell().NoBorder());
            table.AddCell("Всего к оплате:".Phrase(BoldFont).RightCell().NoBorder());
            table.AddCell(price.ToString("N2").Phrase(BoldFont).RightCell().NoBorder());

            document.Add(table);

            document.Add(string.Format(
                             "Всего наименований {0}, на сумму {1} руб." + Environment.NewLine,
                             bill.Count,
                             price.ToString("N2"))
                         .Phrase(DefaultFont));
            document.Add((NumByWords.RurPhrase(price) + Environment.NewLine).Phrase(BoldFont));
            Line(document);
        }
Example #5
0
        private static void AddGoods(Document document, BillData bill)
        {
            var table = new PdfPTable(6)
            {
                WidthPercentage = 100
            };

            table.SetWidths(new[]
            {
                30, 370, 60, 60, 100, 100
            });

            table.AddCell("№".Phrase(BoldFont).CenterCell());
            table.AddCell("Товары (работы, услуги)".Phrase(BoldFont).CenterCell());
            table.AddCell("Кол-во".Phrase(BoldFont).CenterCell());
            table.AddCell("Ед.".Phrase(BoldFont).CenterCell());
            table.AddCell("Цена".Phrase(BoldFont).CenterCell());
            table.AddCell("Сумма".Phrase(BoldFont).CenterCell());

            table.AddCell("1".Phrase(DefaultFont).CenterCell());
            table.AddCell(bill.Goods.Phrase(DefaultFont));
            table.AddCell(bill.Count.ToString(CultureInfo.InvariantCulture).Phrase(DefaultFont));
            table.AddCell("шт.".Phrase(DefaultFont).CenterCell());
            var price = (bill.Price * bill.EuroToRuble).ToString("N2");

            table.AddCell(price.Phrase(DefaultFont).RightCell());
            table.AddCell(price.Phrase(DefaultFont).RightCell());

            document.Add(table);
        }
Example #6
0
        private static void AddHeadAndAccountant(Document document, BillData bill)
        {
            var table = new PdfPTable(4)
            {
                WidthPercentage = 100
            };

            table.SetWidths(new[]
            {
                120, 240, 120, 240
            });
            table.DefaultCell.Border = Rectangle.NO_BORDER;

            table.AddCell("Руководитель".Phrase(BoldFont));
            var headCell = bill.Head.Phrase(BoldFont).RightCell();

            headCell.Border = Rectangle.BOTTOM_BORDER;
            table.AddCell(headCell);

            table.AddCell("Бухгалтер".Phrase(BoldFont));
            var accountantCell = bill.Accountant.Phrase(BoldFont).RightCell();

            accountantCell.Border = Rectangle.BOTTOM_BORDER;
            table.AddCell(accountantCell);

            document.Add(table);
        }
Example #7
0
        // GET: Admin/Export
        public ActionResult Index()
        {
            var model = new BillData().ListAll();

            ViewBag.Name = new UserData().ListAll();
            return(View(model));
        }
Example #8
0
 public void AddOrReplace(long applicationId, BillData data)
 {
     _executor.Execute("[dbo].[Bill_AddOrReplace]",
                       new
     {
         applicationId,
         data.Accountant,
         data.Bank,
         data.BIC,
         data.Client,
         data.CorrespondentAccount,
         data.Count,
         data.CurrentAccount,
         data.Goods,
         data.Head,
         data.HeaderText,
         data.Payee,
         data.Price,
         data.Shipper,
         data.TaxRegistrationReasonCode,
         data.TIN,
         data.VAT,
         data.EuroToRuble,
         data.Number,
         data.SaveDate,
         data.SendDate
     });
 }
Example #9
0
        protected void lblCancelBooth_Click(object sender, EventArgs e)
        {
            DS       = new DataSet();
            billdata = new BillData();
            int flag = 11;
            int id   = Convert.ToInt32(hfBoothOrderId.Value);
            //Convert.ToInt32(dpBillType.SelectedItem.Value);
            int CancelBy = GlobalInfo.Userid;
            int result   = billdata.CancelOrderById(id, flag, CancelBy, dpBillType.SelectedItem.Text);

            if (result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Order Cancelled Successfully";
                pnlError.Update();

                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
        private void ChangeBillDataAmounts(BillData data, decimal baseprice)
        {
            decimal newprice       = baseprice * Convert.ToDecimal(1.5);
            decimal newAmount      = newprice * Convert.ToDecimal(data.Quantity);
            decimal newVatPercent  = Convert.ToDecimal(data.VatPercent.Replace("%", "")); // надо перепроверить тут строка "0.2"!!
            decimal newAmountOfVat = newAmount * newVatPercent;
            decimal newTotalamount = newAmount + newAmountOfVat;
            string  resprice       = null;
            string  resAmount      = null;
            string  resAmountOfVat = null;
            string  resTotalamount = null;

            if (separator == ",")
            {
                resprice       = Convert.ToString(newprice).Replace(".", ",");
                resAmount      = Convert.ToString(newAmount).Replace(".", ",");;
                resAmountOfVat = Convert.ToString(newAmountOfVat).Replace(".", ",");;
                resTotalamount = Convert.ToString(newTotalamount).Replace(".", ",");;
            }
            else if (separator == ".")
            {
                resprice       = Convert.ToString(newprice).Replace(",", ".");
                resAmount      = Convert.ToString(newAmount).Replace(",", ".");;
                resAmountOfVat = Convert.ToString(newAmountOfVat).Replace(",", ".");;
                resTotalamount = Convert.ToString(newTotalamount).Replace(",", ".");;
            }
            data.Price       = resprice;
            data.Amount      = resAmount;
            data.AmountOfVat = resAmountOfVat;
            data.TotalAmount = resTotalamount; // надо провести округления !!!!
        }
        //Action
        public void MakeTheCheckedBill(string path, string course, string pathtosave)
        {
            DeepCopier copier = new DeepCopier();

            GetDataFromBill(path);
            GammaMod.GetAll();
            foreach (var billposition in bills)
            {
                FurcomMod.GetByName(billposition.Name.GeneralName);
                FurcomIdReceiver IdReceiver      = new FurcomIdReceiver();
                FurcomModel      loc             = (FurcomModel)FurcomMod;
                string           id              = IdReceiver.GetIdFromFurcomProductDescr(loc.SelectedData[0].Description);
                CheckerGammaList GetterFromGamma = new CheckerGammaList();
                GammaModel       loc2            = (GammaModel)GammaMod;
                GetterFromGamma.FindOfferInGammaBase(id, loc2.SelectedData);
                offer    result      = GetterFromGamma.FoundOffer;
                BillData newbilldata = copier.DeepClone <BillData>(billposition); //  это надо проверить
                decimal  targetprice = ConvertRURintoBYN(course, result.Price);
                ChangeBillDataAmounts(newbilldata, targetprice);
                OutputBills.Add(newbilldata);
            }
            BillFormer former = new BillFormer();

            former.FormBill(pathtosave, OutputBills, Raredata);
        }
Example #12
0
        public GenerateTokenRequest SetBill(BillData billData)
        {
            AddAdditionalData(nameof(billData.BillId), billData.BillId);
            AddAdditionalData(nameof(billData.PayId), billData.PayId);
            AddAdditionalData(nameof(billData.PhoneNumber), billData.PhoneNumber);

            return(SetServiceType(ServiceType.Bill));
        }
        public JsonResult ChangeStatus(long id)
        {
            var result = new BillData().ChangeStatus(id);

            return(Json(new
            {
                status = result
            }));
        }
        // GET: Admin/Bill
        public ActionResult Index(string searchString, int page = 1, int pageSize = 4)
        {
            var data  = new BillData();
            var model = data.ListAllBill(searchString, page, pageSize);

            ViewBag.Bill         = data.ListAll();
            ViewBag.User         = new UserData().ListAll();
            ViewBag.SearchString = searchString;
            return(View(model));
        }
Example #15
0
        /// <summary>
        /// Гүйлгээний мэдээллийг JSON форматанд хөрвүүлэн
        /// сугалаа,баримтын дугаар, QR код г.м мэдээллийг үүсгэнэ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonCreateBill_Click(object sender, EventArgs e)
        {
            var data = new BillData();

            data.posNo         = textBoxPosNo.Text;
            data.amount        = textBoxAmount.Text;
            data.vat           = textBoxVat.Text;
            data.cashAmount    = textBoxCash.Text;
            data.nonCashAmount = textBoxNonCash.Text;
            data.billIdSuffix  = textBoxNumber.Text;

            var lstBillStock = new List <BillDetail>();

            foreach (DataGridViewRow row in dataGridViewStocks.Rows)
            {
                if (!row.IsNewRow)
                {
                    var stock = new BillDetail();
                    stock.code        = row.Cells["Code"].Value.ToString();
                    stock.name        = row.Cells["ItemName"].Value.ToString();
                    stock.measureUnit = row.Cells["MeasureUnit"].Value.ToString();
                    stock.qty         = row.Cells["Qty"].Value.ToString();
                    stock.unitPrice   = row.Cells["UnitPriceNonVat"].Value.ToString();
                    stock.totalAmount = row.Cells["Amount"].Value.ToString();
                    stock.vat         = row.Cells["Vat"].Value.ToString();
                    stock.barCode     = row.Cells["BarCode"].Value.ToString();
                    stock.cityTax     = row.Cells["CityTax"].Value.ToString();
                    lstBillStock.Add(stock);
                }
            }
            data.cityTax          = textBoxCityTax.Text;
            data.bankTransactions = this.ListBankTranscation;

            if (lstBillStock.Count == 0)
            {
                lstBillStock = null;
            }
            data.stocks = lstBillStock;

            data.districtCode = textBoxDistrict.Text;

            var json   = new JavaScriptSerializer().Serialize(data);
            var result = Program.put(json);

            this.resultData = new JavaScriptSerializer().Deserialize <Result>(result);

            if ("True".Equals(this.resultData.success.ToString()))
            {
                print();
            }
            else
            {
                MessageBox.Show(resultData.message);
            }
        }
Example #16
0
        private static void AddHeader(Document document, BillData bill)
        {
            var header = new Paragraph(bill.HeaderText.Phrase(SmallFont))
            {
                SpacingAfter     = 30,
                Alignment        = Element.ALIGN_CENTER,
                IndentationLeft  = 50,
                IndentationRight = 50
            };

            document.Add(header);
        }
Example #17
0
        private void bindList()
        {
            string result = string.Empty;

            billdata = new BillData();
            DS       = new DataSet();

            DS = billdata.GetOrdersForEdit((Convert.ToDateTime(txtDate.Text)).ToString("dd-MM-yyyy"), Convert.ToInt32(dpRoute.SelectedItem.Value), Convert.ToInt32(dpBrand.SelectedValue));


            rpOrderList.DataSource = DS;
            rpOrderList.DataBind();
        }
Example #18
0
        public ActionResult Success(long id)
        {
            var session = (UserLogin)Session[CommonConstants.USER_SESSION];

            if (session == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            var model = new BillData().ListBillByID(session.userID, id);

            ViewBag.UserName = session.name;
            return(View(model));
        }
Example #19
0
        private void bindList()
        {
            string result = string.Empty;

            billdata = new BillData();
            DS       = new DataSet();
            int flag = 0;

            DS = billdata.GetEditReturnSchemeDetails((Convert.ToDateTime(txtDate.Text)).ToString("dd-MM-yyyy"), Convert.ToInt32(dpRoute.SelectedItem.Value), flag);


            rpOrderList.DataSource = DS;
            rpOrderList.DataBind();
        }
Example #20
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            billdata = new BillData();
            DS       = new DataSet();

            DS = billdata.GetOrdersForCancel(txtBillNo.Text.ToString(), Convert.ToInt32(dpBillType.SelectedItem.Value), 10);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                lblBoothName.Text    = DS.Tables[0].Rows[0]["Bname"].ToString();
                lblCreatedBy.Text    = DS.Tables[0].Rows[0]["ename"].ToString();
                lblTotalBill.Text    = Convert.ToDecimal(DS.Tables[0].Rows[0]["TotalBill"]).ToString("#0.00");
                hfBoothOrderId.Value = DS.Tables[0].Rows[0]["OrderId"].ToString();
                lblCancelBooth.Text  = "Cancel";
                string empname;
                string agencyname;
                try
                {
                    empname = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["EmployeeName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["EmployeeName"].ToString();
                }
                catch (Exception) { empname = string.Empty; }
                try
                {
                    agencyname = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["AgentName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["AgentName"].ToString();
                }
                catch (Exception) { agencyname = string.Empty; }

                if (empname == string.Empty && agencyname == string.Empty)
                {
                    lblName.Text = "Local Sale";
                }
                else if (!(empname == string.Empty) && agencyname == string.Empty)
                {
                    lblName.Text = DS.Tables[0].Rows[0]["EmployeeCode"].ToString() + ' ' + DS.Tables[0].Rows[0]["EmployeeName"].ToString();
                }
                else if (empname == string.Empty && !(agencyname == string.Empty))
                {
                    lblName.Text = DS.Tables[0].Rows[0]["AgentCode"].ToString() + ' ' + DS.Tables[0].Rows[0]["AgentName"].ToString();
                }
            }
            else
            {
                lblBoothName.Text   = "No Order Found";
                lblName.Text        = string.Empty;
                lblCreatedBy.Text   = string.Empty;
                lblTotalBill.Text   = string.Empty;
                lblCancelBooth.Text = string.Empty;
            }
        }
Example #21
0
        private static void AddBankDetails(Document document, BillData bill)
        {
            var table = new PdfPTable(4)
            {
                WidthPercentage = 100
            };

            table.SetWidths(new[]
            {
                220, 220, 60, 220
            });

            var bankPhrase = (bill.Bank + Environment.NewLine + Environment.NewLine).Phrase(DefaultFont);

            bankPhrase.Add("Банк получателя".Phrase(SmallFont));
            table.AddCell(new PdfPCell(bankPhrase)
            {
                Colspan = 2,
                Rowspan = 2
            });
            table.AddCell("БИК".Phrase(DefaultFont));
            table.AddCell(bill.BIC.Phrase(DefaultFont));
            table.AddCell("Сч. №".Phrase(DefaultFont));
            table.AddCell(bill.CorrespondentAccount.Phrase(DefaultFont));

            table.AddCell(("ИНН " + bill.TIN).Phrase(DefaultFont));
            table.AddCell(("КПП " + bill.TaxRegistrationReasonCode).Phrase(DefaultFont));
            table.AddCell(new PdfPCell("Сч. №".Phrase(DefaultFont))
            {
                Rowspan = 2
            });
            table.AddCell(new PdfPCell(bill.CurrentAccount.Phrase(DefaultFont))
            {
                Rowspan = 2
            });

            var payeePhrase = (bill.Payee + Environment.NewLine + Environment.NewLine).Phrase(DefaultFont);

            payeePhrase.Add("Получатель".Phrase(SmallFont));
            table.AddCell(new PdfPCell(payeePhrase)
            {
                Colspan = 2
            });

            document.Add(table);

            document.Add(Environment.NewLine.Phrase(DefaultFont));
        }
Example #22
0
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                DataSet  DS3           = new DataSet();
                BillData printbilldata = new BillData();

                DS3 = printbilldata.UpdatePrintedBillByDate((Convert.ToDateTime(txtDate.Text)).ToString("dd-MM-yyyy"), Convert.ToInt32(dpRoute.SelectedItem.Value), Convert.ToInt32(dpAgentSelasEMployee.SelectedItem.Value));
            }
            catch
            {
                txtDate.Focus();
                dpAgentSelasEMployee.Focus();
                dpRoute.Focus();
            }
        }
Example #23
0
        private static void Fill(Document document, BillData bill)
        {
            AddHeader(document, bill);

            AddBankDetails(document, bill);

            AddTitle(document, bill);

            AddParticipants(document, bill);

            AddGoods(document, bill);

            AddMoney(document, bill);

            AddHeadAndAccountant(document, bill);
        }
        public async Task <IActionResult> PayBill(PayBillViewModel data)
        {
            try
            {
                var billData   = new BillData(data.BillId, data.PayId, data.PhoneNumber);
                var tokenModel = await _services.GenerateBillToken(data.Amount, GenerateCallbackUrl(Request), billData, data.Mobile);

                return(View("Pay", tokenModel));
            }
            catch (Exception exc)
            {
                return(View("Error", new ErrorViewModel
                {
                    Message = exc.Message
                }));
            }
        }
Example #25
0
        private void GetDetails(int id)
        {
            DS       = new DataSet();
            billdata = new BillData();
            int    flag = 1;
            double qty  = 0;

            DS = billdata.GetOrdersbyOrderDetailsId(id, flag, qty);
            if (!Comman.Comman.IsDataSetEmpty(DS))
            {
                if (!string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ProductName"].ToString()))
                {
                    txtName.Text        = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["EmployeeName"].ToString()) ? DS.Tables[0].Rows[0]["AgentName"].ToString() : DS.Tables[0].Rows[0]["EmployeeName"].ToString();
                    txtProductName.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["ProductName"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["ProductName"].ToString();
                    txtPrvQuantity.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["Qty"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["Qty"].ToString();
                    txtNewQuantity.Text = string.Empty;
                    //txtIfsc.Text = string.IsNullOrEmpty(DS.Tables[0].Rows[0]["IFSCcode"].ToString()) ? string.Empty : DS.Tables[0].Rows[0]["IFSCcode"].ToString();
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                }
                else
                {
                    flag = 3;

                    int result = billdata.EditOrders(id, flag, qty);
                    if (result > 0)
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = false;
                        divSusccess.Visible = true;
                        lblSuccess.Text     = "Edited  Successfully";
                        pnlError.Update();
                        bindList();
                        uprouteList.Update();
                    }
                    else
                    {
                        divDanger.Visible   = false;
                        divwarning.Visible  = true;
                        divSusccess.Visible = false;
                        lblwarning.Text     = "Please Contact to Site Admin";
                        pnlError.Update();
                    }
                }
            }
        }
Example #26
0
        private static void AddParticipants(Document document, BillData bill)
        {
            var table = new PdfPTable(2)
            {
                WidthPercentage = 100
            };

            table.SetWidths(new[]
            {
                100, 620
            });
            table.DefaultCell.Border = Rectangle.NO_BORDER;
            table.SpacingAfter       = 6;

            table.AddCell("Поставщик:".Phrase(DefaultFont));
            table.AddCell(bill.Shipper.Phrase(BoldFont));
            table.AddCell("Покупатель:".Phrase(DefaultFont));
            table.AddCell(bill.Client.Phrase(BoldFont));

            document.Add(table);
        }
Example #27
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DS       = new DataSet();
            billdata = new BillData();
            int id     = Convert.ToInt32(hbankId.Value);
            int result = 0;

            double qty = string.IsNullOrEmpty(txtNewQuantity.Text)? 0: Convert.ToDouble(txtNewQuantity.Text);

            if (qty != 0)
            {
                int flag = 2;
                result = billdata.EditOrders(id, flag, qty);
            }
            else
            {
                int flag = 4;
                result = billdata.EditOrders(id, flag, qty);
            }

            if (result > 0)
            {
                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Edited  Successfully";
                pnlError.Update();
                bindList();
                uprouteList.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }
Example #28
0
 public BillModel GetBillModel(BillData bill)
 {
     return(new BillModel
     {
         BankDetails = new BankDetails
         {
             Bank = bill.Bank,
             BIC = bill.BIC,
             CorrespondentAccount = bill.CorrespondentAccount,
             CurrentAccount = bill.CurrentAccount,
             Payee = bill.Payee,
             TaxRegistrationReasonCode = bill.TaxRegistrationReasonCode,
             TIN = bill.TIN
         },
         Accountant = bill.Accountant,
         Head = bill.Head,
         HeaderText = bill.HeaderText,
         Shipper = bill.Shipper,
         Client = bill.Client,
         Count = bill.Count,
         Goods = bill.Goods,
         PriceRuble = bill.Price * bill.EuroToRuble
     });
 }
        private void GetDataFromBill(string path)
        {
            int  beginrow  = 0;
            int  endrow    = 0;
            bool beginflag = false;
            bool endflag   = false;

            bills = new List <BillData>();
            FileInfo file = new FileInfo(path);

            Raredata = new RareMutableData();
            using (ExcelPackage exc = new ExcelPackage(file))
            {
                ExcelWorksheet worksheet = exc.Workbook.Worksheets[1];
                ExcelRange     Dimension = worksheet.Cells;
                for (int i = 1; i < Dimension.End.Row; i++)
                {
                    if (worksheet.Cells[i, 1].Value.ToString() == "Продавец:")
                    {
                        Raredata.User = worksheet.Cells[i, 3].Value.ToString();
                    }
                    else if (worksheet.Cells[i, 1].Value.ToString().Contains("Пред-счет"))
                    {
                        Raredata.Date = worksheet.Cells[i, 1].Value.ToString().Replace("Пред-счет №б/н от ", "").Replace(" года", "").Trim();
                    }
                    else if (worksheet.Cells[i, 1].Value.ToString() == "Покупатель:")
                    {
                        Raredata.Buyer = worksheet.Cells[i, 3].Value.ToString();
                    }
                    if (worksheet.Cells[i, 1].Value.ToString() == "№")
                    {
                        beginrow  = i;
                        beginflag = true;
                    }
                    else if (worksheet.Cells[i, 1].Value.ToString() == "Итого")
                    {
                        endrow  = i;
                        endflag = true;
                    }
                    else if (beginflag & endflag)
                    {
                        break;
                    }
                }
                if (beginflag && endflag)
                {
                    for (int i = beginrow + 1; i < endrow; i++)
                    {
                        BillData loc = new BillData();

                        loc.Position     = i;
                        loc.BillPosition = Convert.ToInt32(worksheet.Cells[i, 1].Value);
                        loc.Name         = new BillPositionName(worksheet.Cells[i, 2].Value.ToString());
                        loc.Quantity     = worksheet.Cells[i, 3].Value.ToString();
                        loc.Package      = worksheet.Cells[i, 4].Value.ToString();
                        loc.Price        = worksheet.Cells[i, 5].Value.ToString();
                        loc.Amount       = worksheet.Cells[i, 6].Value.ToString();
                        loc.VatPercent   = worksheet.Cells[i, 7].Value.ToString();
                        loc.AmountOfVat  = worksheet.Cells[i, 8].Value.ToString();
                        loc.TotalAmount  = worksheet.Cells[i, 9].Value.ToString();

                        bills.Add(loc);
                    }
                }
            }
        }
Example #30
0
        protected void btnemployeeOrdersubmit_click(object sender, EventArgs e)
        {
            if (dpEmployee.SelectedItem.Value != "0")
            {
                int         result      = 0;
                Invoice     inovice     = new Invoice();
                InvoiceData invoiceData = new InvoiceData();
                inovice.orderDate      = (Convert.ToDateTime(txtEmployeeOrderDate.Text)).ToString("dd-MM-yyyy");
                inovice.AgencyID       = 0;
                inovice.ShecemeApplied = true;

                //salesEmployee
                DataSet  ds       = new DataSet();
                BillData billData = new BillData();
                ds = billData.getEmployeeByUserId(GlobalInfo.Userid);
                inovice.SaleEmployeeId = string.IsNullOrEmpty(ds.Tables[0].Rows[0]["EmployeeID"].ToString()) ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["EmployeeID"]);

                inovice.EmployeeID     = Convert.ToInt32(dpEmployee.SelectedItem.Value);
                inovice.totalCoast     = string.IsNullOrEmpty(hfemployeeTotalBill.Value) ? 0 : Comman.Comman.IsValidInteger(hfemployeeTotalBill.Value) ? Convert.ToDouble(hfemployeeTotalBill.Value) : 0;
                inovice.CreatedBy      = GlobalInfo.Userid;
                inovice.CreatedDate    = DateTime.Now.ToString("dd/MM/yyyy");
                inovice.TokanId        = hftokanno.Value;
                inovice.orderType      = 2;// employeeORder
                inovice.CurrentBoothID = GlobalInfo.CurrentbothID;
                inovice.PaymentMode    = "Employee";

                DataSet chkds = new DataSet();
                chkds = invoiceData.CheckBoothTemp(inovice, 1);
                if (!Comman.Comman.IsDataSetEmpty(chkds))
                {
                    result = invoiceData.BoothInserOrder(inovice);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Add Items')", true);
                }
                if (result > 0)
                {
                    //ScriptManager.RegisterStartupScript(pnlBill2, pnlBill2.GetType(), "PrintPanel2", "PrintPanel2()", true))
                    updateStock();
                    btnPrintEmp.Visible             = true;
                    Button1.Visible                 = false;
                    btnAddEmployeeOrderItem.Visible = false;
                    btnEmployeeNewOrder.Visible     = false;
                    btnRemoveOrder.Visible          = false;
                    pnlBill2.Visible                = false;
                    pnlBills.Visible                = true;
                    divDanger.Visible               = false;
                    divwarning.Visible              = false;
                    divSusccess.Visible             = true;
                    pnlError.Update();
                    upMain.Update();
                    pnlBill2.Enabled = false;
                }
                else
                {
                    divDanger.Visible   = false;
                    divwarning.Visible  = true;
                    divSusccess.Visible = false;
                    lblwarning.Text     = "Please Contact to Site Admin";
                    pnlError.Update();
                }
            }
            else
            {
                // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please Select Employee')", true);
            }
        }