public static void UpdatePoState(int poId, int state) { po poMain = (poEntity.po.First(item => item.poId == poId)); poMain.poStates = (sbyte)state; poEntity.SaveChanges(); }
/// <summary> /// 创建新的 po 对象。 /// </summary> /// <param name="poId">poId 属性的初始值。</param> public static po Createpo(global::System.Int32 poId) { po po = new po(); po.poId = poId; return(po); }
public static void SetPoNumber(int poId) { po poItem = poEntity.po.Where(item => item.poId == poId).First(); poItem.poNo = Tool.Get6DigitalNumberAccordingToId(poId); poEntity.SaveChanges(); }
public static void UpdatePo(po poMain) { po poItem = poEntity.po.Where(item => item.poId == poMain.poId).First(); poItem = poMain; poEntity.SaveChanges(); }
public void FillTheTable(po poMain) { this.poId = poMain.poId; tbVendor.Text = poMain.vendorName; tbContact.Text = poMain.contact; cbPa.SelectedItem = buyerIdsAndNames[poMain.pa.Value]; tbVendorNumber.Text = poMain.vendorNumber; tbPoDate.Text = poMain.poDate.Value.ToShortDateString(); tbPoNo.Text = poMain.poNo; tbFreight.Text = poMain.freight; tbShipMethod.Text = poMain.shipMethod; tbPaymentTerms.Text = poMain.paymentTerms; tbShipToLocation.Text = poMain.shipToLocation; tbBillTo.Text = poMain.billTo; tbShipTo.Text = poMain.shipTo; foreach (poitems itemDb in PoMgr.PoMgr.GetPoItemsAccordingToPoId(poMain.poId)) { poItemsStateList.Add(new PoItemContentAndState { poItem = itemDb, state = OrderItemsState.Normal } ); } FillTheDataGridPoItems(); }
/// <summary> /// 创建新的 po 对象。 /// </summary> /// <param name="poId">poId 属性的初始值。</param> /// <param name="vendorName">vendorName 属性的初始值。</param> /// <param name="contact">contact 属性的初始值。</param> /// <param name="pa">pa 属性的初始值。</param> /// <param name="poDate">poDate 属性的初始值。</param> public static po Createpo(global::System.Int32 poId, global::System.String vendorName, global::System.String contact, global::System.Int16 pa, global::System.DateTime poDate) { po po = new po(); po.poId = poId; po.vendorName = vendorName; po.contact = contact; po.pa = pa; po.poDate = poDate; return(po); }
public static void UpdatePo(po poMain) { po poItem = poEntity.po.Where(item => item.poId == poMain.poId).First(); // poItem = poMain; poItem.vendorName = poMain.vendorName; poItem.contact = poMain.contact; poItem.pa = poMain.pa; poItem.vendorNumber = poMain.vendorName; poItem.freight = poMain.freight; poItem.shipMethod = poMain.shipMethod; poItem.paymentTerms = poMain.paymentTerms; poItem.shipToLocation = poMain.shipToLocation; poItem.billTo = poMain.billTo; poItem.shipTo = poMain.shipTo; poEntity.SaveChanges(); }
public static void UpdatePo(po poMain) { po poItem = poEntity.po.Where(item => item.poId == poMain.poId).First(); // poItem = poMain; poItem.vendorName = poMain.vendorName; poItem.contact = poMain.contact; poItem.pa = poMain.pa; poItem.vendorNumber=poMain.vendorName; poItem.freight=poMain.freight; poItem.shipMethod=poMain.shipMethod; poItem.paymentTerms=poMain.paymentTerms; poItem.shipToLocation=poMain.shipToLocation; poItem.billTo=poMain.billTo; poItem.shipTo = poMain.shipTo; poEntity.SaveChanges(); }
public static void SavePoMain(po poMain) { poEntity.po.AddObject(poMain); poEntity.SaveChanges(); }
/// <summary> /// 用于向 po EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet<T> 属性的 .Add 方法。 /// </summary> public void AddTopo(po po) { base.AddObject("po", po); }
static void FillThePoSheet(ISheet sheet,po po, List<PoItemContentAndState> poitemList) { sheet.GetRow(0).CreateCell(2).SetCellValue(po.vendorName); sheet.GetRow(0).CreateCell(9).SetCellValue(po.contact); sheet.GetRow(0).CreateCell(14).SetCellValue(AmbleClient.Admin.AccountMgr.AccountMgr.GetNameById((int)po.pa)); sheet.GetRow(1).CreateCell(2).SetCellValue(po.vendorNumber); if (po.poDate != null) { sheet.GetRow(1).CreateCell(5).SetCellValue(po.poDate.ToShortDateString()); } sheet.GetRow(1).CreateCell(9).SetCellValue(po.poNo); sheet.GetRow(1).CreateCell(14).SetCellValue(po.paymentTerms); sheet.GetRow(2).CreateCell(2).SetCellValue(po.shipMethod); sheet.GetRow(2).CreateCell(9).SetCellValue(po.freight); sheet.GetRow(2).CreateCell(14).SetCellValue(po.shipToLocation); IRow row = sheet.CreateRow(4); row.CreateCell(0).SetCellValue(po.billTo); row.CreateCell(10).SetCellValue(po.shipTo); int itemRowIndex = 9; int totalQty = 0; float totalTotal = 0;int totalQtyRecd = 0; foreach (PoItemContentAndState pcs in poitemList) { IRow itemRow = sheet.CreateRow(itemRowIndex); itemRow.CreateCell(0).SetCellValue(poitemList.IndexOf(pcs)+1); itemRow.CreateCell(1).SetCellValue(pcs.poItem.partNo); itemRow.CreateCell(2).SetCellValue(pcs.poItem.mfg); itemRow.CreateCell(3).SetCellValue(pcs.poItem.dc); itemRow.CreateCell(4).SetCellValue(pcs.poItem.vendorIntPartNo); itemRow.CreateCell(5).SetCellValue(pcs.poItem.coo); itemRow.CreateCell(6).SetCellValue(pcs.poItem.qty); totalQty += pcs.poItem.qty; if (pcs.poItem.qtyRecd != null) { itemRow.CreateCell(7).SetCellValue(pcs.poItem.qtyRecd.Value); totalQtyRecd += pcs.poItem.qtyRecd.Value; } if(pcs.poItem.qtyCorrected!=null) itemRow.CreateCell(8).SetCellValue(pcs.poItem.qtyCorrected.Value); if(pcs.poItem.qtyAccept!=null) itemRow.CreateCell(9).SetCellValue(pcs.poItem.qtyAccept.Value); if(pcs.poItem.qtyRejected!=null) itemRow.CreateCell(10).SetCellValue(pcs.poItem.qtyRejected.Value); if(pcs.poItem.qtyRTV!=null) itemRow.CreateCell(11).SetCellValue(pcs.poItem.qtyRTV.Value); if(pcs.poItem.qcPending!=null) itemRow.CreateCell(12).SetCellValue(pcs.poItem.qcPending.Value); itemRow.CreateCell(13).SetCellValue(Enum.GetName(typeof(AmbleClient.Currency), pcs.poItem.currency)); itemRow.CreateCell(14).SetCellValue(pcs.poItem.unitPrice.Value); itemRow.CreateCell(15).SetCellValue(pcs.poItem.qty*pcs.poItem.unitPrice.Value); totalTotal += pcs.poItem.qty* pcs.poItem.unitPrice.Value; itemRow.CreateCell(16).SetCellValue(pcs.poItem.dockDate.ToShortDateString()); if(pcs.poItem.receiveDate!=null) itemRow.CreateCell(17).SetCellValue(pcs.poItem.receiveDate.Value.ToShortDateString()); itemRow.CreateCell(18).SetCellValue(pcs.poItem.stepCode); itemRow.CreateCell(19).SetCellValue("Unknown"); itemRowIndex++; IRow infoRow = sheet.CreateRow(itemRowIndex); infoRow.CreateCell(1).SetCellValue("Note To Vendor >>" + pcs.poItem.noteToVendor); sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(itemRowIndex, itemRowIndex, 1, 16)); itemRowIndex++; } //add total bar IRow totalRow=sheet.CreateRow(itemRowIndex); sheet.AddMergedRegion(new NPOI.SS.Util.CellRangeAddress(itemRowIndex,itemRowIndex,0,4)); totalRow.CreateCell(5).SetCellValue("Total"); totalRow.CreateCell(6).SetCellValue(totalQty); totalRow.CreateCell(7).SetCellValue(totalQtyRecd); totalRow.CreateCell(15).SetCellValue(totalTotal); }
public PoView(po poMain) { InitializeComponent(); poList = new List<po>(); poList.Add(poMain); }
public static void SavePoDocx(po po, List<PoItemContentAndState> poitemsList) { document = DocX.Load(@"PoDocx.dll"); Formatting format = new Formatting(); format.FontFamily = new System.Drawing.FontFamily("Arial"); format.Size = 9; Table soTable = document.Tables[0]; soTable.Rows[0].Cells[1].Paragraphs[0].InsertText(po.vendorName, false, format); soTable.Rows[0].Cells[3].Paragraphs[0].InsertText(Tool.Get6DigitalNumberAccordingToId(po.poId), false, format); soTable.Rows[1].Cells[3].Paragraphs[0].InsertText((po.poDate.Year + "-" + po.poDate.Month + "-" + po.poDate.Day).ToString(), false, format); soTable.Rows[2].Cells[3].Paragraphs[0].InsertText(po.paymentTerms, false, format); soTable.Rows[3].Cells[1].Paragraphs[0].InsertText(po.contact, false, format); //soTable.Rows[4].Cells[3].Paragraphs[0].InsertText(po.freight, false, format); soTable.Rows[4].Cells[1].Paragraphs[0].InsertText(AllAccountInfo.GetNameAccordingToId(po.pa), false, format); custvendorinfo custven = CustVenInfoManager.GetUniqueCustVenInfo(1,po.vendorName, UserInfo.UserId); if (custven != null) { soTable.Rows[1].Cells[1].Paragraphs[0].InsertText(custven.phone1, false, format); soTable.Rows[2].Cells[1].Paragraphs[0].InsertText(custven.fax, false, format); } Table itemTable = document.Tables[1]; if (poitemsList.Count > 2) { Row sampleRow = itemTable.Rows[2]; for (int i = 0; i < poitemsList.Count - 2; i++) { itemTable.InsertRow(sampleRow,3); } } float totalAmount = 0; for (int i = 0; i < poitemsList.Count; i++) { itemTable.Rows[i + 2].Cells[0].Paragraphs[0].InsertText((i + 1).ToString(),false,format); itemTable.Rows[i + 2].Cells[1].Paragraphs[0].InsertText(poitemsList[i].poItem.partNo, false, format); itemTable.Rows[i + 2].Cells[2].Paragraphs[0].InsertText(poitemsList[i].poItem.mfg, false, format); itemTable.Rows[i + 2].Cells[3].Paragraphs[0].InsertText(poitemsList[i].poItem.qty.ToString(), false, format); //itemTable.Rows[i+2].Cells[4].Paragraphs[0].InsertText(poitemsList[i].poItem.cr if (poitemsList[i].poItem.currency == (int)Currency.USD) { itemTable.Rows[i + 2].Cells[5].Paragraphs[0].InsertText(poitemsList[i].poItem.unitPrice.ToString(), false, format); itemTable.Rows[i + 2].Cells[6].Paragraphs[0].InsertText((poitemsList[i].poItem.unitPrice * poitemsList[i].poItem.qty).ToString(), false, format); } else { itemTable.Rows[i + 2].Cells[5].Paragraphs[0].InsertText(poitemsList[i].poItem.unitPrice.ToString() + Enum.GetName(typeof(Currency), poitemsList[i].poItem.currency), false, format); itemTable.Rows[i + 2].Cells[6].Paragraphs[0].InsertText((poitemsList[i].poItem.unitPrice * poitemsList[i].poItem.qty).ToString() + Enum.GetName(typeof(Currency), poitemsList[i].poItem.currency), false, format); } if (poitemsList[i].poItem.unitPrice.HasValue) { totalAmount += poitemsList[i].poItem.unitPrice.Value * poitemsList[i].poItem.qty; } } itemTable.Rows[itemTable.Rows.Count - 1].Cells[6].Paragraphs[0].InsertText(totalAmount.ToString(), false, format); WriteToFile(); }
/// <summary> /// 创建新的 po 对象。 /// </summary> /// <param name="poId">poId 属性的初始值。</param> public static po Createpo(global::System.Int32 poId) { po po = new po(); po.poId = poId; return po; }
/// <summary> /// 创建新的 po 对象。 /// </summary> /// <param name="poId">poId 属性的初始值。</param> /// <param name="vendorName">vendorName 属性的初始值。</param> /// <param name="contact">contact 属性的初始值。</param> /// <param name="pa">pa 属性的初始值。</param> /// <param name="poDate">poDate 属性的初始值。</param> public static po Createpo(global::System.Int32 poId, global::System.String vendorName, global::System.String contact, global::System.Int16 pa, global::System.DateTime poDate) { po po = new po(); po.poId = poId; po.vendorName = vendorName; po.contact = contact; po.pa = pa; po.poDate = poDate; return po; }