Example #1
0
        /// <summary>
        /// ����һ��Item
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool AddItem(SOInvoicePageItemInfo itemInfo)
        {
            int count;
            int realLength;
            //����Dz�Ʒ�У�ȥ����ɼ����ַ��ij���<font style='FONT-SIZE: 7pt'>xxx</font>
            if ( itemInfo.IsSOItem )
            {
                if ( itemInfo.ProductName.IndexOf("<font style='FONT-SIZE:")!=-1)
                {
                    realLength = itemInfo.ProductName.Length - 36;
                }
                else
                {
                    realLength = itemInfo.ProductName.Length;
                }

                count = realLength/AppConst.NameMaxLength;
                if(realLength%AppConst.NameMaxLength != 0)
                {
                    count++;
                }
            }
            else
            {//���ӷ�
                count = 1;
            }

            if(ItemLineCount + count > AppConst.PageMaxLine)
            {
                return false;
            }
            ItemLineCount += count;
            ItemHash.Add(itemInfo.ProductID,itemInfo);
            return true;
        }
Example #2
0
        /// <summary>
        /// 增加一个Item
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public bool AddItem(SOInvoicePageItemInfo itemInfo)
        {
            int count;
            int realLength;

            //如果是产品行,去掉不可见的字符的长度<font style='FONT-SIZE: 7pt'>xxx</font>
            if (itemInfo.IsSOItem)
            {
                if (itemInfo.ProductName.IndexOf("<font style='FONT-SIZE:") != -1)
                {
                    realLength = itemInfo.ProductName.Length - 36;
                }
                else
                {
                    realLength = itemInfo.ProductName.Length;
                }

                count = realLength / AppConst.NameMaxLength;
                if (realLength % AppConst.NameMaxLength != 0)
                {
                    count++;
                }
            }
            else
            {            //运杂费
                count = 1;
            }

            if (ItemLineCount + count > AppConst.PageMaxLine)
            {
                return(false);
            }
            ItemLineCount += count;
            ItemHash.Add(itemInfo.ProductID, itemInfo);
            return(true);
        }
Example #3
0
        private void InitPageList(SOInfo soInfo,SOInvoiceInfo invoice)
        {
            invoice.HasServiceProduct = false;
            int index = 0;
            SOInvoicePageInfo page = new SOInvoicePageInfo();
            invoice.ItemPageHash.Add(index++,page);
            if(soInfo.ItemHash.Count>0)
            {
                Hashtable sysNoHash = new Hashtable();
                foreach(SOItemInfo item in soInfo.ItemHash.Values)
                {
                    sysNoHash.Add(item.ProductSysNo,item.ProductSysNo);
                }
                Hashtable idHash = ProductManager.GetInstance().GetProductBoundle(sysNoHash);
                Hashtable posHash = InventoryManager.GetInstance().GetInventoryStockBoundle(sysNoHash,soInfo.StockSysNo);
                foreach(SOItemInfo item in soInfo.ItemHash.Values)
                {
                    SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                    foreach(ProductBasicInfo pbInfo in idHash.Values)
                    {
                        if(pbInfo.SysNo == item.ProductSysNo)
                        {
                            printItem.ProductSysNo = pbInfo.SysNo;
                            printItem.ProductID = pbInfo.ProductID;
                            printItem.ProductName = pbInfo.ProductName;

                            if (item.BaseProductType == (int)AppEnum.ProductType.Service)
                                invoice.HasServiceProduct = true;

                            break;
                        }
                    }
                    foreach(InventoryStockInfo isInfo in posHash.Values)
                    {
                        if(isInfo.ProductSysNo == item.ProductSysNo)
                        {
                            if ( isInfo.Position1 != "00-000-000" )
                            {
                                //printItem.ProductName += "(��:" + isInfo.Position1 + ")";
                                printItem.ProductName += "(��:<font size=4>" + isInfo.Position1 + "</font>)";
                            }
                            else if ( isInfo.Position2 != "00-000-000" )
                            {
                                //printItem.ProductName += "(��:" + isInfo.Position2 + ")";
                                printItem.ProductName += "(��:<font size=4>" + isInfo.Position2 + "</font>)";
                            }
                            break;
                        }
                    }
                    printItem.Quantity = item.Quantity;
                    printItem.Weight = item.Weight;
                    printItem.Price = item.Price;
                    printItem.SubTotal = item.Quantity*item.Price;
                    printItem.IsPoint = false;

                    printItem.IsSOItem = true;
                    printItem.Warranty = item.Warranty;

                    if(page.AddItem(printItem) == true)
                    {
                        continue;
                    }
                    else
                    {
                        page = new SOInvoicePageInfo();
                        invoice.ItemPageHash.Add(index++,page);
                        page.AddItem(printItem);
                    }
                }
            }
            if(soInfo.ShipPrice != 0)
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "�˷�";
                printItem.SubTotal = soInfo.ShipPrice;
                printItem.IsSOItem = false;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }

            if (soInfo.FreeShipFeePay != 0)
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "���˷ѽ��";
                printItem.SubTotal = -soInfo.FreeShipFeePay;
                printItem.IsSOItem = false;
                if (page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++, page);
                    page.AddItem(printItem);
                }
            }

            if(soInfo.DiscountAmt!=0)
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "�����Ż�";
                printItem.SubTotal = -soInfo.DiscountAmt;
                printItem.IsSOItem = false;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }

            if(soInfo.PremiumAmt != 0)
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "���۷�";
                printItem.SubTotal = soInfo.PremiumAmt;
                printItem.IsSOItem = false;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }

            if(soInfo.PayPrice != 0)
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "����������";
                printItem.SubTotal = soInfo.PayPrice;
                printItem.IsSOItem = false;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }

            if(soInfo.GetTotalAmt() != this.GetEndMoney(soInfo))
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "ȥ��ͷ";
                printItem.SubTotal = soInfo.GetTotalAmt()-this.GetEndMoney(soInfo);
                printItem.IsSOItem = false;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }
            if(soInfo.PointPay != 0)
            {
                SOInvoicePageItemInfo printItem= new SOInvoicePageItemInfo();
                printItem.ProductID="�������ֵֿ�";
                printItem.SubTotal=Convert.ToDecimal(soInfo.PointPay)/AppConst.ExchangeRate*(-1);
                printItem.IsSOItem = false;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }

            if(soInfo.PointAmt != 0)
            {
                SOInvoicePageItemInfo printItem = new SOInvoicePageItemInfo();
                printItem.ProductID = "�����ɵû���";
                printItem.SubTotal = Convert.ToDecimal(soInfo.PointAmt);
                printItem.IsSOItem= false;
                printItem.IsPoint = true;
                if(page.AddItem(printItem) == false)
                {
                    page = new SOInvoicePageInfo();
                    invoice.ItemPageHash.Add(index++,page);
                    page.AddItem(printItem);
                }
            }
        }