private SellerInfo GetSellerInfo()
        {
            SellerInfo seller = new SellerInfo();
            //seller.BankAccount = /*OurDetailsConfiguration.Current.BankAccount;*/ AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].BankAccount;
            //seller.BankCode = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].BankCode;
            //seller.BankName = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].BankName;
            seller.CompanyName = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].Name;
            //seller.CorrAccount = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].CorrAccount;
            //seller.Inn = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].INN;
            //seller.KPP = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].KPP;

            return seller;
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int orderID = Convert.ToInt32(Request["OrderID"]);

            Order order = OrderBO.LoadOrderData(SiteContext.Current.CurrentClient.Profile.ClientId, orderID );
            if (order == null)
                throw new HttpException((int)HttpStatusCode.NotFound , "Order not found" );

            _seller = GetSellerInfo();//OrderService.GetSellerInfo();
            _profile = SiteContext.Current.CurrentClient.Profile;
            _sum = decimal.Round( order.Total * SiteContext.Current.CurrentClient.Profile.PrepaymentPercent / 100, 2 );
            _paymentName = string.Format( "{0}", OrderTracking.GetOrderDisplayNumber( order ) );
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            //для проверки
            //Session["PrintOrderLineIDs"] = "82;83;72;79;76";
            RmsAuto.Store.Acctg.ClientProfile cl = RmsAuto.Store.Acctg.ClientProfile.Load((string)Session["ClientID"]);
            //номер накладной: ID клиента + / + часы минуты секунды без разделителя
            InvoiceNumber = cl.AcctgId + "/" + DateTime.Now.ToString("hhmmss");//DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
            ClientName = string.Join(", ", new string[] { cl.ClientName, "ИНН " + cl.INN, "КПП " + cl.CorrespondentIBAN, cl.ShippingAddress, cl.ContactPhone });
            object source = Session["PrintOrderLineIDs"];
            _seller = GetSellerInfo();

            SupplierName = string.Join(", ", new string[] { _seller.CompanyName, "ИНН" + _seller.Inn, "КПП" + _seller.KPP, _seller.Address, _seller.Phone });
            if (source != null && !string.IsNullOrEmpty(source.ToString()))
            {
                string[] str = source.ToString().Split(';');
                int[] ids = Array.ConvertAll(str, s => int.Parse(s));

                PrintOrderLineInfo[] printLines = null;
                using (var dc = new DCFactory<StoreDataContext>())
                {
                    printLines = (from ol in dc.DataContext.OrderLines
                                  where ids.Contains(ol.OrderLineID)
                                  select new PrintOrderLineInfo()
                                  {
                                      Number = 0,
                                      PartNumber = ol.PartNumber,
                                      PartName = ol.PartName,
                                      Manufacturer = ol.Manufacturer,
                                      Qty = ol.Qty,
                                      Price = ol.UnitPrice,
                                      Total = ol.Total
                                  }).ToArray();

                    Array.ForEach(printLines, (x) => x.Number = Array.IndexOf(printLines, x) + 1);
                }
                rptMain.DataSource = printLines;
                rptMain.DataBind();

                SumTotal = printLines.Sum(l => l.Total);
                QtyTotal = printLines.Count();
            }
            else
            {
                throw new ArgumentException("PrintOrderLineIDs");
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            int orderID = Convert.ToInt32(Request["OrderID"]);

            Order order = OrderBO.LoadOrderData(SiteContext.Current.CurrentClient.Profile.ClientId, orderID);
            if (order == null)
                throw new HttpException((int)HttpStatusCode.NotFound, "Order not found");

            _seller = GetSellerInfo();//OrderService.GetSellerInfo();
            _profile = SiteContext.Current.CurrentClient.Profile;
            _sum = decimal.Round(order.Total * SiteContext.Current.CurrentClient.Profile.PrepaymentPercent / 100, 2);
            _paymentName = string.Format("{0}", OrderTracking.GetOrderDisplayNumber(order));

            SupplierName = _seller.CompanyName + "," + _seller.Inn + "," + _seller.KPP + "," + _seller.Address + "," + _seller.Phone;
            ClientName = string.Join(", ", new string[] { _profile.ClientName, _profile.BankINN, _profile.KPP, _profile.ShippingAddress, _profile.ContactPhone });
            //if (source != null && !string.IsNullOrEmpty(source.ToString()))
            {
            //	string[] str = source.ToString().Split(';');
            //	int[] ids = Array.ConvertAll(str, s => int.Parse(s));

                PrintOrderLineInfo[] printLines = null;
                using (var dc = new DCFactory<StoreDataContext>())
                {
                    printLines = (from ol in dc.DataContext.OrderLines
                                  where ol.OrderID == orderID
                                  select new PrintOrderLineInfo()
                                  {
                                      Number = 0,
                                      PartNumber = ol.PartNumber,
                                      PartName = ol.PartName,
                                      Qty = ol.Qty,
                                      Price = ol.UnitPrice,
                                      Total = ol.Total
                                  }).ToArray();

                    Array.ForEach(printLines, (x) => x.Number = Array.IndexOf(printLines, x) + 1);
                }
                rptMain.DataSource = printLines;
                rptMain.DataBind();

                SumTotal = printLines.Sum(l => l.Total);
                QtyTotal = printLines.Count();
            }
        }
Example #5
0
        protected SellerInfo GetSellerInfo()
        {
            SellerInfo seller = new SellerInfo();
            seller.CompanyName = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].Name;
            seller.Address = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].Address;
            seller.License = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].License;
            seller.Issued = AcctgRefCatalog.RmsFranches[SiteContext.Current.InternalFranchName].Issued;

            return seller;
        }