private SortedDictionary <int, ArrayList> getPurchaseSupplierData(out double sumTotleMoney) { SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>(); SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>(); list = PurchaseInOrder.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill, 1); m_dataGridRecordCount = list.Count; sumTotleMoney = getSumTotleMoney(list); for (int index = 0; index < list.Count; index++) { PurchaseInOrderTable record = new PurchaseInOrderTable(); record = (PurchaseInOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(index + 1); temp.Add(record.supplierId); temp.Add(record.supplierName); temp.Add(record.totalMoney); temp.Add(getPercentValue(Convert.ToDouble(record.totalMoney.ToString()), sumTotleMoney)); sortedDictionaryList.Add(index, temp); } return(sortedDictionaryList); }
private void save_Click(object sender, EventArgs e) { // 得到详细的采购信息 ArrayList dataList = getPurchaseInOrderDetailsValue(); if (dataList.Count > 0) { // 采购订单表头和表尾信息 PurchaseInOrderTable record = getPurchaseInOrderValue(); if (purchaseOrderIsFull(record) && purchaseOrderDetailsIsFull(dataList)) { PurchaseInOrder.getInctance().insert(record, false); PurchaseInOrderDetails.getInctance().insert(dataList); BillNumber.getInctance().inserBillNumber(BillTypeNumber, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString()); if (m_billNumber.Length == 0) { MessageBoxExtend.messageOK("数据保存成功"); } this.Close(); } } else { MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败."); } }
// 记账按钮事件 private void registerInLedger_Click(object sender, EventArgs e) { try { save_Click(sender, e); PurchaseInOrder.getInctance().registerInLedger(m_billNumber, m_isRedBill); } catch (Exception exp) { MessageBoxExtend.messageError(exp.ToString()); } }
private void toolStripButtonReview_Click(object sender, EventArgs e) { try { save_Click(sender, e); PurchaseInOrder.getInctance().billReview(m_billNumber); } catch (Exception exp) { MessageBoxExtend.messageError(exp.ToString()); } }
private void toolStripButtonRefreshHS_Click(object sender, EventArgs e) { if (m_orderType == CountType.PurchaseMateriel) { PurchaseInOrderDetails.getInctance().refreshRecord(); } else if (m_orderType == CountType.PurchasePeople) { PurchaseInOrder.getInctance().refreshRecord(); } else if (m_orderType == CountType.PurchaseSupplier) { PurchaseInOrder.getInctance().refreshRecord(); } else if (m_orderType == CountType.PurchaseHistoryPrice) { PurchaseInOrderDetails.getInctance().refreshRecord(); } else if (m_orderType == CountType.SaleMateriel) { SaleOutOrderDetails.getInctance().refreshRecord(); } else if (m_orderType == CountType.SalePeople) { SaleOutOrder.getInctance().refreshRecord(); } else if (m_orderType == CountType.SaleCustomer) { SaleOutOrder.getInctance().refreshRecord(); } else if (m_orderType == CountType.SaleHistoryPrice) { SaleOutOrderDetails.getInctance().refreshRecord(); } else if (m_orderType == CountType.StorageMaterielOut) { MaterielOutOrderDetails.getInctance().refreshRecord(); } else if (m_orderType == CountType.StorageManagerMaterielCount) { StorageStockDetail.getInctance().refreshRecord(); } else if (m_orderType == CountType.MaterielInOutCount) { StorageStockDetail.getInctance().refreshRecord(); } else if (m_orderType == CountType.StorageManagerProduceIn) { MaterielInOrderDetails.getInctance().refreshRecord(); } updateDataGridView(); }
private void toolStripButtonRefresh_Click(object sender, EventArgs e) { // 刷新按钮逻辑 if (m_orderType == OrderType.PurchaseOrder) { PurchaseOrder.getInctance().refreshRecord(); } else if (m_orderType == OrderType.PurchaseIn) { PurchaseInOrder.getInctance().refreshRecord(); } else if (m_orderType == OrderType.PurchaseInvoice) { } else if (m_orderType == OrderType.PurchaseOrderExcute) { PurchaseOrder.getInctance().refreshRecord(); } else if (m_orderType == OrderType.PurchaseInOrderExcute) { PurchaseInOrder.getInctance().refreshRecord(); } else if (m_orderType == OrderType.StorageProductIn) { // 仓存管理-产品入库 MaterielInOrder.getInctance().refreshRecord(); } else if (m_orderType == OrderType.StorageInCheck) { // 仓存管理-盘盈入库 MaterielInEarningsOrder.getInctance().refreshRecord(); } else if (m_orderType == OrderType.StorageInOther) { // 仓存管理-其他入库 MaterielInOtherOrder.getInctance().refreshRecord(); } updateDataGridView(); }
private void readBillInfoToUI() { // 单据表头表尾信息 m_purchaseInOrder = PurchaseInOrder.getInctance().getPurchaseInfoFromBillNumber(m_billNumber); m_supplierPkey = m_purchaseInOrder.supplierId; m_staffSavePkey = m_purchaseInOrder.staffSaveId; m_staffCheckPkey = m_purchaseInOrder.staffCheckId; this.labelPurchaseName.Visible = true; this.labelTradingDate.Visible = true; this.labelBillNumber.Visible = true; this.labelPurchaseType.Visible = true; this.labelPaymentDate.Visible = true; this.labelSummary.Visible = true; this.labelBusinessPeople.Visible = true; this.labelMakeBillStaff.Visible = true; this.labelReviewBillStaff.Visible = true; this.labelReviewDate.Visible = true; this.labelSourceOrderType.Visible = true; this.labelSourceOrderNumber.Visible = true; this.labelSave.Visible = true; this.labelVerify.Visible = true; this.labelContractNum.Visible = true; this.labelPurchaseName.Text = m_purchaseInOrder.supplierName; this.labelTradingDate.Text = m_purchaseInOrder.tradingDate; this.labelBillNumber.Text = m_purchaseInOrder.billNumber; this.labelContractNum.Text = m_purchaseInOrder.contractNum; this.labelPurchaseType.Text = m_purchaseInOrder.purchaseType; this.labelPaymentDate.Text = m_purchaseInOrder.paymentDate; this.labelSummary.Text = m_purchaseInOrder.exchangesUnit; m_staffPkey = m_purchaseInOrder.businessPeopleId; this.labelBusinessPeople.Text = m_purchaseInOrder.businessPeopleName; this.labelMakeBillStaff.Text = m_purchaseInOrder.makeOrderStaffName; this.labelSourceOrderType.Text = m_purchaseInOrder.sourceBillType; this.labelSourceOrderNumber.Text = m_purchaseInOrder.sourceBillNumber; this.labelSave.Text = m_purchaseInOrder.staffSaveName; this.labelVerify.Text = m_purchaseInOrder.staffCheckName; this.labelContractNum.Text = m_purchaseInOrder.contractNum; // DataGridView 赋值 SortedDictionary <int, PurchaseInOrderDetailsTable> purchaseOrderDetails = PurchaseInOrderDetails.getInctance().getPurchaseInfoFromBillNumber(m_billNumber); foreach (KeyValuePair <int, PurchaseInOrderDetailsTable> index in purchaseOrderDetails) { PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable(); record = index.Value; int rowIndex = Convert.ToInt32(record.rowNumber.ToString()) - 1; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value = record.materielID; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielName].Value = record.materielName; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Model].Value = record.materielModel; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Brand].Value = record.brand; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value = record.materielUnitPurchase; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Price].Value = record.price; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value = record.value; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Turnover].Value = record.sumMoney; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.TransportationCost].Value = record.costApportionments; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.OtherCost].Value = record.noCostApportionments; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.SumTurnover].Value = record.totalMoney; } // 如果单据已审核,则禁用页面所有控件 if (m_purchaseInOrder.isReview == "1") { this.labelReviewBillStaff.Text = m_purchaseInOrder.orderrReviewName; this.labelReviewDate.Text = m_purchaseInOrder.reviewDate; this.panelIsReview.Visible = true; this.save.Enabled = false; this.toolStripButtonReview.Enabled = false; this.panelPurchaseName.Visible = false; this.panelTradingDate.Visible = false; this.panelPurchaseType.Visible = false; this.panelPaymentDate.Visible = false; this.panelSummary.Visible = false; this.textBoxPurchaseName.Visible = false; this.dateTimePickerTradingDate.Visible = false; this.comboBoxPurchaseType.Visible = false; this.dateTimePickerPaymentDate.Visible = false; this.textBoxSummary.Visible = false; this.panelBusinessPeople.Visible = false; this.registerInLedger.Enabled = true; this.redBill.Enabled = false; this.blueBill.Enabled = false; } else { this.labelReviewBillStaff.Visible = false; this.labelReviewDate.Visible = false; this.registerInLedger.Enabled = false; } // 如果单据已经记账,则出来红字已记账提示 if (m_purchaseInOrder.isInLedger == 1) { this.panelInLedger.Visible = true; this.registerInLedger.Enabled = false; this.dataGridViewDataList.ReadOnly = true; this.dataGridViewDataCount.ReadOnly = true; } else { this.dataGridViewDataList.Enabled = true; this.dataGridViewDataCount.Enabled = true; } if (m_purchaseInOrder.isRedBill == 1) { m_isRedBill = true; this.panelRed.Visible = true; } }
private void toolStripButtonReview_Click(object sender, EventArgs e) { /* * 函数实现逻辑 * 1、检查界面数据有效性 * 1、查看付款单类型是否是应付账款,如果是,则根据供应商ID,更新应付账款表 * 2、根据付款方科目是现金或银行存款,计算本次交易完成后对应账户的余额 * 3、更新相应表的IS_REVIEW字段 * 4、提示保存成功,如果保存失败,提示保存失败的原因 * */ if (DbPublic.getInctance().isCheckOut()) { MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,无法再审核单据!"); return; } if (!checkUiValue()) { return; } ; if (m_billNumber.Length > 0) { if (m_isBankBill) { double currentSystemBankBalance = BalanceManager.getBankBalance(m_bankRecord.bankName); if (m_bankRecord.turnover > currentSystemBankBalance) { string msg = "付款交易失败\n"; msg += "[" + m_bankRecord.bankName + "]余额为:"; msg += Convert.ToString(currentSystemBankBalance) + ",不足以完成本次支付."; MessageBoxExtend.messageWarning(msg); return; } else { BankCashsubLedger.getInctance().update( m_billNumber, DbPublic.getInctance().getCurrentLoginUserID(), currentSystemBankBalance - m_bankRecord.turnover); } } else { double currentSystemCachBalance = BalanceManager.getCachBalance(); if (m_cashRecord.turnover > currentSystemCachBalance) { string msg = "付款交易失败\n"; msg += "库存现金余额为:"; msg += Convert.ToString(currentSystemCachBalance) + ",不足以完成本次支付."; MessageBoxExtend.messageWarning(msg); return; } else { CashCashsubLedger.getInctance().update( m_billNumber, DbPublic.getInctance().getCurrentLoginUserID(), currentSystemCachBalance - m_cashRecord.turnover); } } if (this.comboBoxPaymentType.Text.IndexOf("应付") != -1) { updateAccountPayment(); } else if (this.comboBoxPaymentType.Text.IndexOf("采购入库") != -1) { PurchaseInOrder.getInctance().updataPaymentInfo(this.textBoxSourceOrderNumber.Text.ToString(), Convert.ToDouble(textBoxTransactionAmount.Text.ToString())); } MessageBoxExtend.messageOK("审核成功."); OperatorLog.getInctance().insert(502, "单据审核[" + m_billNumber + "]"); this.Close(); } }
private void updateDataGridView(int materielID = -1) { if (materielID == -1) { this.upRecord.Enabled = true; this.nextRecord.Enabled = true; if (m_currentRecordIndex < 0) { MessageBoxExtend.messageOK("已是首条记录"); return; } else if (m_currentRecordIndex >= m_materielList.Count) { MessageBoxExtend.messageOK("已是尾条记录"); return; } else { materielID = ((MaterielTable)m_materielList[m_currentRecordIndex]).pkey; } } else { this.upRecord.Enabled = false; this.nextRecord.Enabled = false; } // 期初余额 ArrayList firstRow = new ArrayList(); ArrayList sumRow = new ArrayList(); ArrayList lastRow = new ArrayList(); SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>(); SortedDictionary <int, StorageStockDetailTable> list = new SortedDictionary <int, StorageStockDetailTable>(); #region 期初余额记录行 StorageStockDetailTable firstRecord = StorageStockDetail.getInctance().getMaterielStorageStockDetailInfo(materielID, m_countStartDate); firstRow.Add(formatStringToMonth(m_countStartDate, 4)); firstRow.Add(""); firstRow.Add(""); firstRow.Add("期初结存"); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); firstRow.Add(""); if (firstRecord != null) { firstRow.Add(firstRecord.storageValue); firstRow.Add(firstRecord.storagePrice); firstRow.Add((double)(Math.Round(firstRecord.storageMoney * 100)) / 100); } else { firstRow.Add("0"); firstRow.Add("0"); firstRow.Add("0"); } sortedDictionaryList.Add(sortedDictionaryList.Count, firstRow); #endregion #region 当前时间段交易记录 list = StorageStockDetail.getInctance().getMaterielStorageStockDetailInfo(materielID, m_countStartDate, m_countEndDate); m_dataGridRecordCount = list.Count + 3; double inSumValue = 0, inSumMoney = 0, outSumValue = 0, outSumMoney = 0, stockSumValue = 0, stockSumPrice = 0, stockSumMoney = 0; for (int index = 0; index < list.Count; index++) { StorageStockDetailTable record = new StorageStockDetailTable(); record = (StorageStockDetailTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(formatStringToMonth(record.tradingDate, 5)); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.thingsType); if (record.isIn == 0) { // 出库类单据 temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(record.value); temp.Add(record.price); temp.Add(record.value * record.price); // 未完成:这里的信息需要显示项目编号和生产编号,如何添加 string projectNo = "", makeNo = ""; if (record.thingsType == "生产领料") { MaterielOutOrderTable materieOutOrder = MaterielOutOrder.getInctance().getMaterielOutOrderInfoFromBillNumber(record.billNumber); projectNo = materieOutOrder.projectNo; makeNo = materieOutOrder.makeNo; } else if (record.thingsType == "其他出库") { MaterielOutOtherOrderTable materieOutOrder = MaterielOutOtherOrder.getInctance().getMaterielOutOtherOrderInfoFromBillNumber(record.billNumber); projectNo = materieOutOrder.projectNo; makeNo = materieOutOrder.makeNo; } temp.Add(projectNo); temp.Add(makeNo); temp.Add(record.storageValue); temp.Add(record.storagePrice); temp.Add((double)(Math.Round(record.storageMoney * 100)) / 100); outSumValue += record.value; outSumMoney += record.value * record.price; } else if (record.isIn == 1) { // 入库类单据 temp.Add(record.value); temp.Add(record.price); temp.Add(record.value * record.price); if (record.thingsType == "采购入库") { m_purchaseInOrder = PurchaseInOrder.getInctance().getPurchaseInfoFromBillNumber(record.billNumber); temp.Add(m_purchaseInOrder.supplierName); } else { temp.Add(""); } temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(record.storageValue); temp.Add(record.storagePrice); temp.Add((double)(Math.Round(record.storageMoney * 100)) / 100); inSumValue += record.value; inSumMoney += record.value * record.price; } else { // 其他类型单据 temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(""); temp.Add(record.storageValue); temp.Add(record.storagePrice); temp.Add((double)(Math.Round(record.storageMoney * 100)) / 100); } if (index == list.Count - 1) { stockSumValue = record.storageValue; stockSumPrice = record.storagePrice; stockSumMoney += record.storageMoney; } sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } #endregion #region 合计 sumRow.Add(""); sumRow.Add(""); sumRow.Add(""); sumRow.Add("合计"); sumRow.Add(inSumValue); sumRow.Add(getPercentValue(inSumMoney, inSumValue)); sumRow.Add(inSumMoney); sumRow.Add(""); sumRow.Add(outSumValue); sumRow.Add(getPercentValue(outSumMoney, outSumValue)); sumRow.Add(outSumMoney); sumRow.Add(""); sumRow.Add(""); sumRow.Add(""); sumRow.Add(""); sumRow.Add(""); sortedDictionaryList.Add(sortedDictionaryList.Count, sumRow); #endregion #region 期末结转 lastRow.Add(formatStringToMonth(m_countEndDate, 4)); lastRow.Add(""); lastRow.Add(""); lastRow.Add("期末结存"); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(""); lastRow.Add(stockSumValue); lastRow.Add(stockSumPrice); lastRow.Add((double)(Math.Round(stockSumMoney * 100)) / 100); sortedDictionaryList.Add(sortedDictionaryList.Count, lastRow); #endregion // 设置m_dateGridViewExtend背景为白色 m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList); for (int i = 0; i < sortedDictionaryList.Count; i++) { dataGridViewList.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.White; } dataGridViewList.Rows[0].DefaultCellStyle.BackColor = System.Drawing.Color.LightGoldenrodYellow; dataGridViewList.Rows[sortedDictionaryList.Count - 2].DefaultCellStyle.BackColor = System.Drawing.Color.LightGoldenrodYellow; dataGridViewList.Rows[sortedDictionaryList.Count - 1].DefaultCellStyle.BackColor = System.Drawing.Color.LightGoldenrodYellow; // 更新状态栏信息 updateStatusLable(materielID); }
private void updateDataGridView() { SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>(); if (m_orderType == OrderType.PurchaseOrder) { SortedDictionary <int, PurchaseOrderTable> list = new SortedDictionary <int, PurchaseOrderTable>(); list = PurchaseOrder.getInctance().getAllPurchaseOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseOrderTable record = new PurchaseOrderTable(); record = (PurchaseOrderTable)list[index]; if (m_filter.startDate == null || (record.tradingDate.CompareTo(m_filter.startDate) >= 0 && record.tradingDate.CompareTo(m_filter.endDate) <= 0)) { ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.purchaseType); temp.Add(record.deliveryDate); temp.Add(record.paymentDate); temp.Add(record.sumMoney); temp.Add(record.sumTransportationCost); temp.Add(record.sumOtherCost); temp.Add(record.totalMoney); temp.Add(record.businessPeopleName); temp.Add(record.makeOrderStaffName); if (record.isReview == "0") { temp.Add("否"); } else { temp.Add("是"); } temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.PurchaseIn) { SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>(); list = PurchaseInOrder.getInctance().getAllPurchaseInOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseInOrderTable record = new PurchaseInOrderTable(); record = (PurchaseInOrderTable)list[index]; if (m_filter.startDate == null || (record.tradingDate.CompareTo(m_filter.startDate) >= 0 && record.tradingDate.CompareTo(m_filter.endDate) <= 0)) { ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.purchaseType); temp.Add(record.contractNum); temp.Add(record.paymentDate); temp.Add(record.sourceBillNumber); temp.Add(record.sumMoney); temp.Add(record.sumTransportationCost); temp.Add(record.sumOtherCost); temp.Add(record.totalMoney); temp.Add(record.staffSaveName); temp.Add(record.staffCheckName); temp.Add(record.businessPeopleName); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); temp.Add(record.orderInLedgerName); temp.Add(record.inLedgerDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.PurchaseInvoice) { } else if (m_orderType == OrderType.PurchaseOrderExcute) { SortedDictionary <int, PurchaseOrderTable> list = new SortedDictionary <int, PurchaseOrderTable>(); list = PurchaseOrder.getInctance().getAllPurchaseOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseOrderTable record = new PurchaseOrderTable(); record = (PurchaseOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.deliveryDate); temp.Add(record.sumValue); if (record.isInStorage == "0") { temp.Add("否"); } else { temp.Add("是"); } temp.Add(record.actualValue); temp.Add(record.businessPeopleName); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.PurchaseInOrderExcute) { SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>(); list = PurchaseInOrder.getInctance().getAllPurchaseInOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseInOrderTable record = new PurchaseInOrderTable(); record = (PurchaseInOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.purchaseType); temp.Add(record.paymentDate); temp.Add(record.totalMoney); temp.Add(record.paymentOk); temp.Add(record.paymentNoOk); temp.Add(record.businessPeopleName); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.StorageProductIn) { // 仓存管理-产品入库 SortedDictionary <int, MaterielInOrderTable> list = new SortedDictionary <int, MaterielInOrderTable>(); list = MaterielInOrder.getInctance().getAllMaterielInOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { bool isDisplayRecord = false; MaterielInOrderTable record = new MaterielInOrderTable(); record = (MaterielInOrderTable)list[index]; if (m_filter.startDate == null || (record.tradingDate.CompareTo(m_filter.startDate) >= 0 && record.tradingDate.CompareTo(m_filter.endDate) <= 0)) { // 等于0代表只显示已审核单据 if (m_filter.allReview == "0") { if (record.isReview == "1") { if (m_filter.billColor == "0") // 需要显示蓝字单据 { if (record.isRedBill == 0) { isDisplayRecord = true; } } else if (m_filter.billColor == "1") // 需要显示红字单据 { if (record.isRedBill == 1) { isDisplayRecord = true; } } else // 需要显示全部颜色单据 { isDisplayRecord = true; } } } else { if (m_filter.billColor == "0") // 需要显示蓝字单据 { if (record.isRedBill == 0) { isDisplayRecord = true; } } else if (m_filter.billColor == "1") // 需要显示红字单据 { if (record.isRedBill == 1) { isDisplayRecord = true; } } else // 需要显示全部颜色单据 { isDisplayRecord = true; } } } if (isDisplayRecord) { ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.departmentName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.sumValue); temp.Add(record.sumMoney); temp.Add(record.orderReviewStaffName); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.StorageInCheck) { // 仓存管理-盘盈入库 SortedDictionary <int, MaterielInEarningsOrderTable> list = new SortedDictionary <int, MaterielInEarningsOrderTable>(); list = MaterielInEarningsOrder.getInctance().getAllMaterielInEarningsOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { bool isDisplayRecord = false; MaterielInEarningsOrderTable record = new MaterielInEarningsOrderTable(); record = (MaterielInEarningsOrderTable)list[index]; if (m_filter.startDate == null || (record.tradingDate.CompareTo(m_filter.startDate) >= 0 && record.tradingDate.CompareTo(m_filter.endDate) <= 0)) { // 等于0代表只显示已审核单据 if (m_filter.allReview == "0") { if (record.isReview == "1") { if (m_filter.billColor == "0") // 需要显示蓝字单据 { if (record.isRedBill == 0) { isDisplayRecord = true; } } else if (m_filter.billColor == "1") // 需要显示红字单据 { if (record.isRedBill == 1) { isDisplayRecord = true; } } else // 需要显示全部颜色单据 { isDisplayRecord = true; } } } else { if (m_filter.billColor == "0") // 需要显示蓝字单据 { if (record.isRedBill == 0) { isDisplayRecord = true; } } else if (m_filter.billColor == "1") // 需要显示红字单据 { if (record.isRedBill == 1) { isDisplayRecord = true; } } else // 需要显示全部颜色单据 { isDisplayRecord = true; } } } if (isDisplayRecord) { ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.tradingDate); temp.Add(""); temp.Add(record.billNumber); temp.Add(record.sumValue); temp.Add(record.sumMoney); temp.Add(record.orderReviewStaffName); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.StorageInOther) { // 仓存管理-其他入库 SortedDictionary <int, MaterielInOtherOrderTable> list = new SortedDictionary <int, MaterielInOtherOrderTable>(); list = MaterielInOtherOrder.getInctance().getAllMaterielInOtherOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { bool isDisplayRecord = false; MaterielInOtherOrderTable record = new MaterielInOtherOrderTable(); record = (MaterielInOtherOrderTable)list[index]; if (m_filter.startDate == null || (record.tradingDate.CompareTo(m_filter.startDate) >= 0 && record.tradingDate.CompareTo(m_filter.endDate) <= 0)) { // 等于0代表只显示已审核单据 if (m_filter.allReview == "0") { if (record.isReview == "1") { if (m_filter.billColor == "0") // 需要显示蓝字单据 { if (record.isRedBill == 0) { isDisplayRecord = true; } } else if (m_filter.billColor == "1") // 需要显示红字单据 { if (record.isRedBill == 1) { isDisplayRecord = true; } } else // 需要显示全部颜色单据 { isDisplayRecord = true; } } } else { if (m_filter.billColor == "0") // 需要显示蓝字单据 { if (record.isRedBill == 0) { isDisplayRecord = true; } } else if (m_filter.billColor == "1") // 需要显示红字单据 { if (record.isRedBill == 1) { isDisplayRecord = true; } } else // 需要显示全部颜色单据 { isDisplayRecord = true; } } } if (isDisplayRecord) { ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.tradingDate); temp.Add(""); temp.Add(record.billNumber); temp.Add(record.sumValue); temp.Add(record.sumMoney); temp.Add(record.orderReviewStaffName); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } }
private void exportPurchaseInData() { // 采购入库单数据导出 PurchaseInOrderTable table = new PurchaseInOrderTable(); table = PurchaseInOrder.getInctance().getPurchaseInfoFromBillNumber(m_billNubmber); FormProjectMaterielTable projectInfo = FormProject.getInctance().getProjectInfoFromBillNumber(table.srcOrderNum); stringReplace(table.supplierName, "[1]"); stringReplace(table.billNumber, "[2]"); stringReplace(table.srcOrderNum, "[3]"); stringReplace(projectInfo.projectNum, "[4]"); stringReplace(table.makeOrderStaffName, "[9]"); stringReplace(projectInfo.projectName, "[10]"); stringReplace(table.purchaseNum, "[11]"); stringReplace(table.exchangesUnit, "[12]"); double sum1 = 0.0, sum2 = 0.0, sum3 = 0.0, sum4 = 0.0; for (int row = 0; row < m_dataGridView.RowCount; row++) { if (m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.MatetielNumber].Value.ToString().Length == 0 && m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.MatetielName].Value.ToString().Length == 0) { break; } else { if (m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Value].Value.ToString().Length > 0) { sum1 += Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Value].Value.ToString()); } if (m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Turnover].Value.ToString().Length > 0) { sum2 += Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Turnover].Value.ToString()); } if (m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.TransportationCost].Value.ToString().Length > 0) { sum3 += Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.TransportationCost].Value.ToString()); } if (m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.SumTurnover].Value.ToString().Length > 0) { sum4 += Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.SumTurnover].Value.ToString()); } } int materielID = Convert.ToInt32(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.MatetielNumber].Value.ToString()); MaterielTable record = Materiel.getInctance().getMaterielInfoFromPkey(materielID); m_excelApp.Cells[row + 6, 1] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.MatetielNumber].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 2] = record.brand; m_excelApp.Cells[row + 6, 3] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.MatetielName].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 4] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.ContractMatetielName].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 5] = record.model; m_excelApp.Cells[row + 6, 6] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Unit].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 7] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.CZ].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 8] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Price].Value.ToString().Trim(); if (table.isRedBill == 1) { m_excelApp.Cells[row + 6, 9] = Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Value].Value.ToString().Trim()) * -1; m_excelApp.Cells[row + 6, 10] = Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Turnover].Value.ToString().Trim()) * -1; m_excelApp.Cells[row + 6, 11] = Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.TransportationCost].Value.ToString().Trim()) * -1; m_excelApp.Cells[row + 6, 12] = Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.SumTurnover].Value.ToString().Trim()) * -1; } else { m_excelApp.Cells[row + 6, 9] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Value].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 10] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.Turnover].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 11] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.TransportationCost].Value.ToString().Trim(); m_excelApp.Cells[row + 6, 12] = m_dataGridView.Rows[row].Cells[(int)FormPurchaseInOrder.DataGridColumnName.SumTurnover].Value.ToString().Trim(); } } if (table.isRedBill == 1) { stringReplace(Convert.ToString(sum1 * -1), "[5]"); stringReplace(Convert.ToString(sum2 * -1), "[6]"); stringReplace(Convert.ToString(sum3 * -1), "[7]"); stringReplace(Convert.ToString(sum4 * -1), "[8]"); } else { stringReplace(Convert.ToString(sum1), "[5]"); stringReplace(Convert.ToString(sum2), "[6]"); stringReplace(Convert.ToString(sum3), "[7]"); stringReplace(Convert.ToString(sum4), "[8]"); } }
private void getInfoListFromBillNumber(FormProjectMaterielTable record) { SortedDictionary <int, ProjectManagerDetailsTable> listDetails = new SortedDictionary <int, ProjectManagerDetailsTable>(); listDetails = ProjectManagerDetails.getInctance().getPurchaseInfoFromBillNumber(record.billNumber); SortedDictionary <int, ProjectManagerDetailsTable> changeMaterielList = FormProjectInfoChange.getInctance().getMaterielDetailsFromSrcBillNumber(record.billNumber); for (int index2 = 0; index2 < listDetails.Count; index2++) { ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable(); tmp = (ProjectManagerDetailsTable)listDetails[index2]; // 物料数量可能会存在变更,若发生变更,需要使用变更后数量代替原有数量,在一个材料表中,序号是唯一值 double actualValue = 0.0; int sign = 0; if (tmp.no.Length > 0) { sign = Convert.ToInt32(tmp.no); } if (changeMaterielList.Count > 0 && changeMaterielList.ContainsKey(sign)) { if (tmp.materielID != changeMaterielList[sign].materielID) { // 相当于变更时,使用使用了另外一种物料替换了现有物料, tmp.materielID = changeMaterielList[sign].materielID; tmp.materielName = changeMaterielList[sign].materielName; tmp.num = changeMaterielList[sign].num; tmp.materielModel = changeMaterielList[sign].materielModel; tmp.materielParameter = changeMaterielList[sign].materielParameter; tmp.cl = changeMaterielList[sign].cl; tmp.materielSize = changeMaterielList[sign].materielSize; } actualValue = changeMaterielList[sign].value; changeMaterielList.Remove(sign); } else { actualValue = tmp.value; } ArrayList temp = new ArrayList(); temp.Add(record.billNumber); temp.Add(record.projectNum); temp.Add(record.makeNum); temp.Add(record.deviceMode); temp.Add(record.subName); temp.Add(tmp.materielID); temp.Add(tmp.materielName); temp.Add(tmp.num); temp.Add(tmp.materielModel); temp.Add(tmp.materielParameter); temp.Add(tmp.cl); temp.Add(tmp.materielSize); temp.Add(actualValue); // 得到实际库存 InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(tmp.materielID); temp.Add(MaterielCountdata.value); // 库存预占情况,包含总预占量和本项目预占量 temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID)); temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID, record.billNumber)); // 转采购申请单数量 double appylyCount = PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromProjectNumber(record.billNumber, PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no)); temp.Add(appylyCount); // 采购订单数量 SortedDictionary <int, PurchaseOrderTable> listOrderList = new SortedDictionary <int, PurchaseOrderTable>(); listOrderList = PurchaseOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber); double orderCount = 0; for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++) { PurchaseOrderTable recordOrder = new PurchaseOrderTable(); recordOrder = (PurchaseOrderTable)listOrderList[indexOrderList]; orderCount += PurchaseOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID); } temp.Add(orderCount); // 采购入库数量 SortedDictionary <int, PurchaseInOrderTable> purchaseInOrderList = new SortedDictionary <int, PurchaseInOrderTable>(); purchaseInOrderList = PurchaseInOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber); double purchaseInOrderValueCount = 0; for (int indexOrderList = 0; indexOrderList < purchaseInOrderList.Count; indexOrderList++) { PurchaseInOrderTable recordOrder = new PurchaseInOrderTable(); recordOrder = (PurchaseInOrderTable)purchaseInOrderList[indexOrderList]; purchaseInOrderValueCount += PurchaseInOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID); } temp.Add(purchaseInOrderValueCount); // 生产领料数量 double materielOutOrderValueCount = MaterielOutOrderDetails.getInctance().getMaterielCountInfoFromProject(record.billNumber, PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no)); temp.Add(materielOutOrderValueCount); m_projectInfoList.Add(m_projectInfoList.Count, temp); } // 如果changeMaterielList.count大于0 则代表有 foreach (KeyValuePair <int, ProjectManagerDetailsTable> index3 in changeMaterielList) { ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable(); tmp = index3.Value; ArrayList temp = new ArrayList(); temp.Add(record.billNumber); temp.Add(record.projectNum); temp.Add(record.makeNum); temp.Add(record.deviceMode); temp.Add(record.subName); temp.Add(tmp.materielID); temp.Add(tmp.materielName); temp.Add(tmp.num); temp.Add(tmp.materielModel); temp.Add(tmp.materielParameter); temp.Add(tmp.cl); temp.Add(tmp.materielSize); temp.Add(tmp.value); // 得到实际库存 InitMaterielTable MaterielCountdata = InitMateriel.getInctance().getMaterielInfoFromMaterielID(tmp.materielID); temp.Add(MaterielCountdata.value); // 库存预占情况,包含总预占量和本项目预占量 temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID)); temp.Add(MaterielProOccupiedOrderDetails.getInctance().getMaterielProCountInfoFromProject(tmp.materielID, record.billNumber)); // 转采购申请单数量 double appylyCount = PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromProjectNumber(record.billNumber, PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no)); temp.Add(appylyCount); // 采购订单数量 SortedDictionary <int, PurchaseOrderTable> listOrderList = new SortedDictionary <int, PurchaseOrderTable>(); listOrderList = PurchaseOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber); double orderCount = 0; for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++) { PurchaseOrderTable recordOrder = new PurchaseOrderTable(); recordOrder = (PurchaseOrderTable)listOrderList[indexOrderList]; orderCount += PurchaseOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID); } temp.Add(orderCount); // 采购入库数量 SortedDictionary <int, PurchaseInOrderTable> purchaseInOrderList = new SortedDictionary <int, PurchaseInOrderTable>(); purchaseInOrderList = PurchaseInOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(record.billNumber); double purchaseInOrderValueCount = 0; for (int indexOrderList = 0; indexOrderList < purchaseInOrderList.Count; indexOrderList++) { PurchaseInOrderTable recordOrder = new PurchaseInOrderTable(); recordOrder = (PurchaseInOrderTable)purchaseInOrderList[indexOrderList]; purchaseInOrderValueCount += PurchaseInOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, tmp.materielID); } temp.Add(purchaseInOrderValueCount); // 生产领料数量 double materielOutOrderValueCount = MaterielOutOrderDetails.getInctance().getMaterielCountInfoFromProject(record.billNumber, PublicFuction.getXXMateaielOrderSign(tmp.rowNumber, tmp.sequence, tmp.no)); temp.Add(materielOutOrderValueCount); m_projectInfoList.Add(m_projectInfoList.Count, temp); } }
private void updateDataGridView() { double sumTotleMoney = 0; SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>(); int index = 0; if (m_orderType == CountType.Materiel) { SortedDictionary <int, PurchaseInOrderDetailsTable> list = new SortedDictionary <int, PurchaseInOrderDetailsTable>(); list = PurchaseInOrderDetails.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill); m_dataGridRecordCount = list.Count; sumTotleMoney = getSumTotleMoney(list); for (index = 0; index < list.Count; index++) { PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable(); record = (PurchaseInOrderDetailsTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(index + 1); temp.Add(record.materielID); temp.Add(record.materielName); temp.Add(record.materielModel); temp.Add(record.totalMoney); temp.Add(getPercentValue(record.totalMoney, sumTotleMoney)); sortedDictionaryList.Add(index, temp); } } else if (m_orderType == CountType.People) { SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>(); list = PurchaseInOrder.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill, 2); m_dataGridRecordCount = list.Count; sumTotleMoney = getSumTotleMoney(list); for (index = 0; index < list.Count; index++) { PurchaseInOrderTable record = new PurchaseInOrderTable(); record = (PurchaseInOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(index + 1); temp.Add(record.businessPeopleId); temp.Add(record.businessPeopleName); temp.Add(record.totalMoney); temp.Add(getPercentValue(Convert.ToDouble(record.totalMoney.ToString()), sumTotleMoney)); sortedDictionaryList.Add(index, temp); } } else if (m_orderType == CountType.Supplier) { SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>(); list = PurchaseInOrder.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill, 1); m_dataGridRecordCount = list.Count; sumTotleMoney = getSumTotleMoney(list); for (index = 0; index < list.Count; index++) { PurchaseInOrderTable record = new PurchaseInOrderTable(); record = (PurchaseInOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(index + 1); temp.Add(record.supplierId); temp.Add(record.supplierName); temp.Add(record.totalMoney); temp.Add(getPercentValue(Convert.ToDouble(record.totalMoney.ToString()), sumTotleMoney)); sortedDictionaryList.Add(index, temp); } } // 添加合计行 ArrayList sumRow = new ArrayList(); sumRow.Add(index + 1); sumRow.Add("合计"); sumRow.Add(""); if (m_orderType == CountType.Materiel) { sumRow.Add(""); } sumRow.Add(sumTotleMoney); sumRow.Add("100%"); sortedDictionaryList.Add(index, sumRow); m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList); dataGridViewList.Rows[index].DefaultCellStyle.BackColor = System.Drawing.Color.LightBlue; // 更新状态栏信息 updateStatusLable(); }
private void updateDataGridView() { SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>(); if (m_orderType == OrderType.PurchaseApplyOrder) { SortedDictionary <int, PurchaseApplyOrderTable> list = new SortedDictionary <int, PurchaseApplyOrderTable>(); SortedDictionary <int, PurchaseApplyOrderTable> listOrderList = new SortedDictionary <int, PurchaseApplyOrderTable>(); listOrderList = PurchaseApplyOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum); for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++) { PurchaseApplyOrderTable recordOrder = new PurchaseApplyOrderTable(); recordOrder = (PurchaseApplyOrderTable)listOrderList[indexOrderList]; if (PurchaseApplyOrderDetails.getInctance().getPurchaseValueFromMaterielID(recordOrder.billNumber, m_materielID) > 0) { list.Add(list.Count, recordOrder); } } m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseApplyOrderTable record = new PurchaseApplyOrderTable(); record = (PurchaseApplyOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.applyName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.srcOrderNum); temp.Add(record.paymentDate); temp.Add(record.totalMoney); temp.Add(record.makeOrderStaffName); if (record.isReview == "0") { temp.Add("否"); } else { temp.Add("是"); } temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.PurchaseOrder) { SortedDictionary <int, PurchaseOrderTable> list = new SortedDictionary <int, PurchaseOrderTable>(); SortedDictionary <int, PurchaseOrderTable> listOrderList = new SortedDictionary <int, PurchaseOrderTable>(); listOrderList = PurchaseOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum); for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++) { PurchaseOrderTable recordOrder = new PurchaseOrderTable(); recordOrder = (PurchaseOrderTable)listOrderList[indexOrderList]; if (PurchaseOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, m_materielID) > 0) { list.Add(list.Count, recordOrder); } } m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseOrderTable record = new PurchaseOrderTable(); record = (PurchaseOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.xxMaterielTableNum); temp.Add(record.deliveryDate); temp.Add(record.paymentDate); temp.Add(record.sumMoney); temp.Add(record.sumTransportationCost); temp.Add(record.sumOtherCost); temp.Add(record.totalMoney); temp.Add(record.businessPeopleName); temp.Add(record.makeOrderStaffName); if (record.isReview == "0") { temp.Add("否"); } else { temp.Add("是"); } temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.PurchaseIn) { SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>(); SortedDictionary <int, PurchaseInOrderTable> listOrderList = new SortedDictionary <int, PurchaseInOrderTable>(); listOrderList = PurchaseInOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum); for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++) { PurchaseInOrderTable recordOrder = new PurchaseInOrderTable(); recordOrder = (PurchaseInOrderTable)listOrderList[indexOrderList]; if (PurchaseInOrderDetails.getInctance().getPurchaseValueFromBillNumber(recordOrder.billNumber, m_materielID) > 0) { list.Add(list.Count, recordOrder); } } m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { PurchaseInOrderTable record = new PurchaseInOrderTable(); record = (PurchaseInOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.supplierName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.purchaseType); temp.Add(record.srcOrderNum); temp.Add(record.paymentDate); temp.Add(record.sourceBillNumber); temp.Add(record.sumMoney); temp.Add(record.sumTransportationCost); temp.Add(record.sumOtherCost); temp.Add(record.totalMoney); temp.Add(record.staffSaveName); temp.Add(record.staffCheckName); temp.Add(record.businessPeopleName); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); temp.Add(record.orderInLedgerName); temp.Add(record.inLedgerDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.StorageMaterielOut) { SortedDictionary <int, MaterielOutOrderTable> list = new SortedDictionary <int, MaterielOutOrderTable>(); SortedDictionary <int, MaterielOutOrderTable> listOrderList = new SortedDictionary <int, MaterielOutOrderTable>(); listOrderList = MaterielOutOrder.getInctance().getAllPurchaseOrderInfoFromProjectNum(m_xxMaterielTableNum); for (int indexOrderList = 0; indexOrderList < listOrderList.Count; indexOrderList++) { MaterielOutOrderTable recordOrder = new MaterielOutOrderTable(); recordOrder = (MaterielOutOrderTable)listOrderList[indexOrderList]; if (MaterielOutOrderDetails.getInctance().getPurchaseValueFromMaterielID(recordOrder.billNumber, m_materielID) > 0) { list.Add(list.Count, recordOrder); } } m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { MaterielOutOrderTable record = new MaterielOutOrderTable(); record = (MaterielOutOrderTable)list[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.departmentName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.srcOrderNum); temp.Add(record.makeNo); temp.Add(record.sumValue); temp.Add(record.sumMoney); temp.Add(record.materielOutStaffName); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.ChangeApply) { //m_dateGridViewExtend.addDataGridViewColumn("ID", 30); //m_dateGridViewExtend.addDataGridViewColumn("源单据号", 150); //m_dateGridViewExtend.addDataGridViewColumn("设计人", 80); //m_dateGridViewExtend.addDataGridViewColumn("单据号", 150); //m_dateGridViewExtend.addDataGridViewColumn("变更原因", 300); //m_dateGridViewExtend.addDataGridViewColumn("制单员", 80); //m_dateGridViewExtend.addDataGridViewColumn("审核员", 80); //m_dateGridViewExtend.addDataGridViewColumn("审核日期", 80); // 根据源单据号,得到订单详细单据 if (m_srcChangeOrderBillNumber.Length > 0) { SortedDictionary <int, FormProjectMaterielChangeTable> changtList = FormProjectInfoChange.getInctance().getChangeListFromSrcBillNumber(m_srcChangeOrderBillNumber); m_dataGridRecordCount = changtList.Count; for (int index = 0; index < changtList.Count; index++) { FormProjectMaterielChangeTable record = new FormProjectMaterielChangeTable(); record = (FormProjectMaterielChangeTable)changtList[index]; ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.srcBillNumber); temp.Add(record.designStaffName); temp.Add(record.billNumber); temp.Add(record.changeReason); temp.Add(record.makeOrderStaffName); temp.Add(record.orderrReviewName); temp.Add(record.reviewDate); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } } }