private bool purchaseOrderIsFull(SaleOrderTable record) { if (record.customerId == -1) { MessageBoxExtend.messageWarning("客户信息不完整,单据保存失败"); return(false); } if (record.tradingDate.Length == 0) { MessageBoxExtend.messageWarning("日期不完整,单据保存失败"); return(false); } if (record.billNumber.Length == 0) { MessageBoxExtend.messageWarning("单据号信息不完整,单据保存失败"); return(false); } if (record.saleType.Length == 0) { MessageBoxExtend.messageWarning("销售信息不完整,单据保存失败"); return(false); } if (record.businessPeopleId == -1) { MessageBoxExtend.messageWarning("业务员信息不完整,单据保存失败"); return(false); } return(true); }
private SaleOrderTable getSaleOrderValue() { SaleOrderTable record = new SaleOrderTable(); record.customerId = m_customerPkey; record.tradingDate = this.labelTradingDate.Text; record.billNumber = this.labelBillNumber.Text; record.saleType = this.labelSaleType.Text; record.deliveryDate = this.labelDeliveryDate.Text; record.paymentDate = this.labelPaymentDate.Text; record.exchangesUnit = this.labelSummary.Text; record.sumValue = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Value].Value.ToString(); record.sumMoney = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Turnover].Value.ToString(); record.sumTransportationCost = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.TransportationCost].Value.ToString(); record.sumOtherCost = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.OtherCost].Value.ToString(); record.totalMoney = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.SumTurnover].Value.ToString(); record.businessPeopleId = m_staffPkey; if (m_billNumber.Length == 0) { record.makeOrderStaff = DbPublic.getInctance().getCurrentLoginUserID(); } else { record.makeOrderStaff = m_purchaseOrder.makeOrderStaff; } return(record); }
private void save_Click(object sender, EventArgs e) { // 得到详细的销售信息 ArrayList dataList = getSaleOrderDetailsValue(); if (dataList.Count > 0) { // 销售订单表头和表尾信息 SaleOrderTable record = getSaleOrderValue(); if (purchaseOrderIsFull(record) && purchaseOrderDetailsIsFull(dataList)) { SaleOrder.getInctance().insert(record, false); SaleOrderDetails.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 save_Click(object sender, EventArgs e) { m_isSaveSuccess = false; if ((sender.ToString() == "保存" || sender.ToString() == "审核") && SaleOrder.getInctance().checkBillIsReview(this.labelBillNumber.Text.ToString())) { MessageBoxExtend.messageWarning("单据已被审核,所有数据无法进行更改,无法重复保存或审核\r\n请重新登录或手动刷新后查看单据详情"); return; } this.ActiveControl = this.toolStrip1; // 得到详细的销售信息 ArrayList dataList = getSaleOrderDetailsValue(); if (dataList.Count > 0) { // 销售订单表头和表尾信息 SaleOrderTable record = getSaleOrderValue(); if (purchaseOrderIsFull(record) && purchaseOrderDetailsIsFull(dataList)) { SaleOrder.getInctance().insert(record, false); SaleOrderDetails.getInctance().insert(dataList); BillNumber.getInctance().inserBillNumber(BillTypeNumber, this.labelTradingDate.Text, this.labelBillNumber.Text.ToString()); m_isSaveSuccess = true; if (m_billNumber.Length == 0) { MessageBoxExtend.messageOK("数据保存成功"); } this.Close(); } } else { MessageBoxExtend.messageWarning("此单据不包含任何交易信息,单据保存失败."); } }
private void updateDataGridView() { SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>(); if (m_orderType == OrderType.SaleOrder) { SortedDictionary <int, SaleOrderTable> list = new SortedDictionary <int, SaleOrderTable>(); list = SaleOrder.getInctance().getAllSaleOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { SaleOrderTable record = new SaleOrderTable(); record = (SaleOrderTable)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.customerName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.saleType); 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.SaleOut) { SortedDictionary <int, SaleOutOrderTable> list = new SortedDictionary <int, SaleOutOrderTable>(); list = SaleOutOrder.getInctance().getAllSaleOutOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { SaleOutOrderTable record = new SaleOutOrderTable(); record = (SaleOutOrderTable)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.customerName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.saleType); 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.SaleInvoice) { } else if (m_orderType == OrderType.SaleOrderExcute) { SortedDictionary <int, SaleOrderTable> list = new SortedDictionary <int, SaleOrderTable>(); list = SaleOrder.getInctance().getAllSaleOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { SaleOrderTable record = new SaleOrderTable(); record = (SaleOrderTable)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.customerName); 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.SaleOutOrderExcute) { SortedDictionary <int, SaleOutOrderTable> list = new SortedDictionary <int, SaleOutOrderTable>(); list = SaleOutOrder.getInctance().getAllSaleOutOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { SaleOutOrderTable record = new SaleOutOrderTable(); record = (SaleOutOrderTable)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.customerName); temp.Add(record.tradingDate); temp.Add(record.billNumber); temp.Add(record.saleType); 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.SaleQuotation) { SortedDictionary <int, SaleQuotationOrderTable> list = new SortedDictionary <int, SaleQuotationOrderTable>(); list = SaleQuotationOrder.getInctance().getAllSaleQuotationOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { SaleQuotationOrderTable record = new SaleQuotationOrderTable(); record = (SaleQuotationOrderTable)list[index]; if (m_filter.startDate == null || (record.date.CompareTo(m_filter.startDate) >= 0 && record.date.CompareTo(m_filter.endDate) <= 0) ) { ArrayList temp = new ArrayList(); temp.Add(record.pkey); temp.Add(record.customerName); temp.Add(record.date); temp.Add(record.billNumber); temp.Add(record.content); temp.Add(record.note); temp.Add(record.salemanName); temp.Add(record.contact); temp.Add(record.tel); sortedDictionaryList.Add(sortedDictionaryList.Count, temp); } } m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3); } else if (m_orderType == OrderType.StorageMaterielOut) { // 生产领料单序时薄 SortedDictionary <int, MaterielOutOrderTable> list = new SortedDictionary <int, MaterielOutOrderTable>(); list = MaterielOutOrder.getInctance().getAllMaterielOutOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { bool isDisplayRecord = false; MaterielOutOrderTable record = new MaterielOutOrderTable(); record = (MaterielOutOrderTable)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.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.StorageOutCheck) { // 盘亏毁损单序时薄 SortedDictionary <int, MaterielOutEarningsOrderTable> list = new SortedDictionary <int, MaterielOutEarningsOrderTable>(); list = MaterielOutEarningsOrder.getInctance().getAllMaterielOutEarningsOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { bool isDisplayRecord = false; MaterielOutEarningsOrderTable record = new MaterielOutEarningsOrderTable(); record = (MaterielOutEarningsOrderTable)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(""); temp.Add(record.tradingDate); temp.Add(record.billNumber); 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.StorageOutOther) { // 其他出库单序时薄 SortedDictionary <int, MaterielOutOtherOrderTable> list = new SortedDictionary <int, MaterielOutOtherOrderTable>(); list = MaterielOutOtherOrder.getInctance().getAllMaterielOutOtherOrderInfo(); m_dataGridRecordCount = list.Count; for (int index = 0; index < list.Count; index++) { bool isDisplayRecord = false; MaterielOutOtherOrderTable record = new MaterielOutOtherOrderTable(); record = (MaterielOutOtherOrderTable)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(""); temp.Add(record.tradingDate); temp.Add(record.billNumber); 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); } }
private void readBillInfoToUI() { // 单据表头表尾信息 m_purchaseOrder = SaleOrder.getInctance().getSaleInfoFromBillNumber(m_billNumber); m_customerPkey = m_purchaseOrder.customerId; this.labelSaleName.Visible = true; this.labelTradingDate.Visible = true; this.labelBillNumber.Visible = true; this.labelSaleType.Visible = true; this.labelDeliveryDate.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.labelSaleName.Text = m_purchaseOrder.customerName; this.labelTradingDate.Text = m_purchaseOrder.tradingDate; this.labelBillNumber.Text = m_purchaseOrder.billNumber; this.labelSaleType.Text = m_purchaseOrder.saleType; this.labelDeliveryDate.Text = m_purchaseOrder.deliveryDate; this.labelPaymentDate.Text = m_purchaseOrder.paymentDate; this.labelSummary.Text = m_purchaseOrder.exchangesUnit; m_staffPkey = m_purchaseOrder.businessPeopleId; this.labelBusinessPeople.Text = m_purchaseOrder.businessPeopleName; this.labelMakeBillStaff.Text = m_purchaseOrder.makeOrderStaffName; // DataGridView 赋值 SortedDictionary <int, SaleOrderDetailsTable> purchaseOrderDetails = SaleOrderDetails.getInctance().getSaleInfoFromBillNumber(m_billNumber); foreach (KeyValuePair <int, SaleOrderDetailsTable> index in purchaseOrderDetails) { SaleOrderDetailsTable record = new SaleOrderDetailsTable(); 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.Unit].Value = record.materielUnitSale; 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.transportationCost; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.OtherCost].Value = record.otherCost; dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.SumTurnover].Value = record.totalMoney; } // 如果单据已审核,则禁用页面所有控件 if (m_purchaseOrder.isReview == "1") { this.labelReviewBillStaff.Text = m_purchaseOrder.orderrReviewName; this.labelReviewDate.Text = m_purchaseOrder.reviewDate; this.panelIsReview.Visible = true; this.save.Enabled = false; this.toolStripButtonReview.Enabled = false; this.dataGridViewDataList.ReadOnly = true; this.dataGridViewDataCount.ReadOnly = true; this.panelSaleName.Visible = false; this.panelTradingDate.Visible = false; this.panelSaleType.Visible = false; this.panelDeliveryDate.Visible = false; this.panelPaymentDate.Visible = false; this.panelSummary.Visible = false; this.textBoxSaleName.Visible = false; this.dateTimePickerTradingDate.Visible = false; this.comboBoxSaleType.Visible = false; this.dateTimePickerDeliveryDate.Visible = false; this.dateTimePickerPaymentDate.Visible = false; this.textBoxSummary.Visible = false; this.panelBusinessPeople.Visible = false; } else { this.labelReviewBillStaff.Visible = false; this.labelReviewDate.Visible = false; } }