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); } } }
public SOInvoiceInfo GetSOInvoice(int soSysNo) { SOInvoiceInfo soInvoice = new SOInvoiceInfo(); SOInfo soInfo = SaleManager.GetInstance().LoadSO(soSysNo); if(soInfo == null) { throw new BizException("Sale Order Doesn't Exist!!!"); } if(soInfo.ItemHash == null||soInfo.ItemHash.Count == 0) { throw new BizException("No Product In This Sale Order!!!"); } UserInfo employee = SysManager.GetInstance().LoadUser(soInfo.OutUserSysNo); CustomerInfo customer = CustomerManager.GetInstance().Load(soInfo.CustomerSysNo); if(employee != null) { soInvoice.WarehouseUserCode = employee.UserID; } else { soInvoice.WarehouseUserCode = ""; } soInvoice.CustomerName = customer.CustomerName; soInvoice.ReceiveName = soInfo.ReceiveName; soInvoice.ReceiveContact = soInfo.ReceiveContact; //���Ϻ��ĵ�ַǰ�������� AreaInfo area = ASPManager.GetInstance().LoadArea(soInfo.ReceiveAreaSysNo); //if(area.CityName.IndexOf("�Ϻ���")!=-1) soInvoice.ReceiveAddress = area.ProvinceName+area.CityName+area.DistrictName + "," +soInfo.ReceiveAddress; //else // soInvoice.ReceiveAddress = soInfo.ReceiveAddress; soInvoice.ReceivePhone = soInfo.ReceivePhone; soInvoice.ReceiveCellPhone = soInfo.ReceiveCellPhone; soInvoice.InvoiceNote = soInfo.InvoiceNote; SOIncomeInfo income = SOIncomeManager.GetInstance().LoadValid((int)AppEnum.SOIncomeOrderType.SO,soInfo.SysNo); if(income!=null&&income.IncomeStyle==(int)AppEnum.SOIncomeStyle.Advanced) soInvoice.InvoiceNote = "�Ѹ���; "+soInvoice.InvoiceNote; soInvoice.CustomerSysNo = soInfo.CustomerSysNo; PayTypeInfo ptInfo = ASPManager.GetInstance().LoadPayType(soInfo.PayTypeSysNo); soInvoice.PayTypeName = ptInfo.PayTypeName; soInvoice.SOID = soInfo.SOID; soInvoice.SOSysNo = soInfo.SysNo; soInvoice.OutStockID = soInfo.SOID; ShipTypeInfo stInfo = ASPManager.GetInstance().LoadShipType(soInfo.ShipTypeSysNo); soInvoice.ShipTypeName = stInfo.ShipTypeName; soInvoice.IsVAT = soInfo.IsVAT; this.InitPageList(soInfo,soInvoice); soInvoice.TotalPage = soInvoice.ItemPageHash.Count; soInvoice.TotalWeight = soInfo.GetTotalWeight(); //Icson Change soInvoice.DeliveryMemo = soInfo.DeliveryMemo; if (soInfo.AuditDeliveryDate != AppConst.DateTimeNull) { if (soInfo.AuditDeliveryTimeSpan == 1) { soInvoice.AuditDeliveryDateTime = soInfo.AuditDeliveryDate.ToString(AppConst.DateFormat) + " ����"; } else { soInvoice.AuditDeliveryDateTime = soInfo.AuditDeliveryDate.ToString(AppConst.DateFormat) + " ����"; } } return soInvoice; }