///// <summary> ///// 增加一个Item ///// </summary> ///// <param name="item"></param> ///// <returns></returns> //public bool AddItem(ROInvoicePageItemInfo item) //{ // int count = item.ProductName.Length/AppConst.NameMaxLength; // if(item.ProductName.Length%AppConst.NameMaxLength != 0) // { // count++; // } // if(itemLineCount + count > AppConst.NameMaxLength) // { // return false; // } // itemLineCount += count; // this.ItemHash.Add(item.ProductID,item); // return true; //} /// <summary> /// 增加一个Item /// </summary> /// <param name="item"></param> /// <returns></returns> public bool AddItem(ROInvoicePageItemInfo item) { int count = item.ProductName.Length / AppConst.NameMaxLength; if (item.ProductName.Length % AppConst.NameMaxLength != 0) { count++; } if (itemLineCount + count > AppConst.NameMaxLength) { return(false); } itemLineCount += count; this.ItemHash.Add(item.pk, item); return(true); }
private void InitPageList(ROInfo ro, ROInvoiceInfo invoice) { int index = 0; ROInvoicePageInfo page = new ROInvoicePageInfo(); invoice.ItemHash.Add(index++, page); Hashtable sysHash = new Hashtable(5); foreach (ROItemInfo item in ro.ItemHash.Values) { sysHash.Add(item.ProductSysNo, null); } Hashtable pbHash = ProductManager.GetInstance().GetProductBoundle(sysHash); foreach (ROItemInfo item in ro.ItemHash.Values) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = ((ProductBasicInfo)pbHash[item.ProductSysNo]).ProductID; //add by lucky 2008/04/16 printItem.ProductID = ((ProductBasicInfo)pbHash[item.ProductSysNo]).ProductID; printItem.ProductName = ((ProductBasicInfo)pbHash[item.ProductSysNo]).ProductName; printItem.Quantity = item.Quantity * (-1); printItem.Weight = item.Weight; printItem.Total = (-1) * item.RefundCash; printItem.Price = (decimal)(item.RefundCash / item.Quantity); printItem.isRoItem = true; if (page.AddItem(printItem) == true) { continue; } else { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } sysHash.Add(item.ProductSysNo, null); } if (ro.PointAmt != 0) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = "Ӱ�����"; //add by lucky 2008/04/16 printItem.ProductID = "Ӱ�����"; printItem.Total = Convert.ToDecimal(ro.PointAmt); printItem.isRoItem = false; printItem.isPoint = true; if (page.AddItem(printItem) == false) { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } } if (ro.RedeemAmt != 0) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = "������"; //add by lucky 2008/04/16 printItem.ProductID = "������"; printItem.Total = ro.RedeemAmt; printItem.isRoItem = false; if (page.AddItem(printItem) == false) { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } } }
private void InitPageList(RMARefundInfo oRma, ROInvoiceInfo invoice) { int index = 0; ROInvoicePageInfo page = new ROInvoicePageInfo(); invoice.ItemHash.Add(index++, page); DataSet ds = GetRefundItemDs(oRma.SysNo); foreach (DataRow dr in ds.Tables[0].Rows) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = dr["registersysno"].ToString(); printItem.ProductID = Util.TrimNull(dr["ProductID"]); printItem.ProductName = Util.TrimNull(dr["ProductName"]); decimal refundCash = Util.TrimDecimalNull(dr["RefundCash"]); if (oRma.RefundPayType == (int)AppEnum.RMARefundPayType.TransferPointRefund) refundCash = 0; printItem.Quantity = -1; printItem.Weight = 0; printItem.Total = (-1) * refundCash; printItem.Price = refundCash; printItem.isRoItem = true; if (page.AddItem(printItem) == true) { continue; } else { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } } if (oRma.DeductPointFromCurrentCash != 0) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = "��ػ���"; printItem.ProductID = "��ػ���"; printItem.Total = Convert.ToDecimal(oRma.DeductPointFromCurrentCash); printItem.isRoItem = false; // printItem.isPoint = true; if (page.AddItem(printItem) == false) { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } } if (oRma.CompensateShipPrice != 0) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = "�����˷�"; printItem.ProductID = "�����˷�"; printItem.Total = Convert.ToDecimal(-1 * oRma.CompensateShipPrice); printItem.isRoItem = false; if (page.AddItem(printItem) == false) { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } } if (oRma.PointAmt != 0) { ROInvoicePageItemInfo printItem = new ROInvoicePageItemInfo(); printItem.pk = "Ӱ�����"; printItem.ProductID = "Ӱ�����"; int affectedPoint = oRma.PointAmt; if (oRma.RefundPayType == (int)AppEnum.RMARefundPayType.TransferPointRefund) affectedPoint += Convert.ToInt32(Decimal.Round(oRma.CashAmt * AppConst.ExchangeRate, 0)); printItem.Total = affectedPoint; printItem.isRoItem = false; printItem.isPoint = true; if (page.AddItem(printItem) == false) { page = new ROInvoicePageInfo(); page.AddItem(printItem); invoice.ItemHash.Add(index++, page); } } }
///// <summary> ///// ����һ��Item ///// </summary> ///// <param name="item"></param> ///// <returns></returns> //public bool AddItem(ROInvoicePageItemInfo item) //{ // int count = item.ProductName.Length/AppConst.NameMaxLength; // if(item.ProductName.Length%AppConst.NameMaxLength != 0) // { // count++; // } // if(itemLineCount + count > AppConst.NameMaxLength) // { // return false; // } // itemLineCount += count; // this.ItemHash.Add(item.ProductID,item); // return true; //} /// <summary> /// ����һ��Item /// </summary> /// <param name="item"></param> /// <returns></returns> public bool AddItem(ROInvoicePageItemInfo item) { int count = item.ProductName.Length / AppConst.NameMaxLength; if (item.ProductName.Length % AppConst.NameMaxLength != 0) { count++; } if (itemLineCount + count > AppConst.NameMaxLength) { return false; } itemLineCount += count; this.ItemHash.Add(item.pk, item); return true; }