Exemple #1
0
        private void save_Click(object sender, EventArgs e)
        {
            // 得到详细的销售信息
            ArrayList dataList = getMaterielOutOtherOrderDetailsValue();

            if (dataList.Count > 0)
            {
                // 销售订单表头和表尾信息
                MaterielOutOtherOrderTable record = getMaterielOutOtherOrderValue();
                if (orderInfoIsFull(record) && orderDetailsIsFull(dataList))
                {
                    MaterielOutOtherOrder.getInctance().insert(record, false);
                    MaterielOutOtherOrderDetails.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 toolStripButtonRefresh_Click(object sender, EventArgs e)
        {
            // 刷新按钮逻辑
            if (m_orderType == OrderType.SaleQuotation)
            {
                // 销售管理-销售报价单序时簿
                SaleQuotationOrder.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.SaleOrder)
            {
                // 销售管理-销售订单序时簿
                SaleOrder.getInctance().refreshRecord();
                SaleOrderDetails.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.SaleOut)
            {
                // 销售管理-销售出库单序时簿
                SaleOutOrder.getInctance().refreshRecord();
                SaleOutOrderDetails.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.SaleInvoice)
            {
                // 销售管理-销售发票序时簿(暂时为空就可以)
            }
            else if (m_orderType == OrderType.SaleOrderExcute)
            {
                // 销售管理-销售订单执行情况
                SaleOrder.getInctance().refreshRecord();
                SaleOrderDetails.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.SaleOutOrderExcute)
            {
                // 销售管理-销售出库单收款情况
                SaleOutOrder.getInctance().refreshRecord();
                SaleOutOrderDetails.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.StorageMaterielOut)
            {
                // 仓存管理-生产领料
                MaterielOutOrder.getInctance().refreshRecord();
                MaterielOutOrderDetails.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.StorageOutCheck)
            {
                // 仓存管理-盘亏亏损
                MaterielOutEarningsOrder.getInctance().refreshRecord();
                MaterielOutEarningsOrderDetails.getInctance().refreshRecord();
            }
            else if (m_orderType == OrderType.StorageOutOther)
            {
                // 仓存管理-其他出库
                MaterielOutOtherOrder.getInctance().refreshRecord();
                MaterielOutOtherOrderDetails.getInctance().refreshRecord();
            }

            updateDataGridView();
        }
Exemple #3
0
        private void readBillInfoToUI()
        {
            // 单据表头表尾信息
            m_materieOutOrder = MaterielOutOtherOrder.getInctance().getMaterielOutOtherOrderInfoFromBillNumber(m_billNumber);

            m_staffSavePkey        = m_materieOutOrder.staffSaveId;
            m_materielOutStaffPkey = m_materieOutOrder.materielOutStaffId;

            this.labelTradingDate.Visible     = true;
            this.labelBillNumber.Visible      = true;
            this.labelMakeBillStaff.Visible   = true;
            this.labelReviewBillStaff.Visible = true;
            this.labelReviewDate.Visible      = true;
            this.labelSave.Visible            = true;
            this.labelVerify.Visible          = true;
            this.labelSummary.Visible         = true;

            this.labelTradingDate.Text   = m_materieOutOrder.tradingDate;
            this.labelBillNumber.Text    = m_materieOutOrder.billNumber;
            this.labelMakeBillStaff.Text = m_materieOutOrder.makeOrderStaffName;
            this.labelSave.Text          = m_materieOutOrder.staffSaveName;
            this.labelVerify.Text        = m_materieOutOrder.materielOutStaffName;
            this.labelSummary.Text       = m_materieOutOrder.exchangesUnit;

            // DataGridView 赋值
            writeBillDetailsInfoFromBillNumber(m_billNumber);

            // 如果单据已审核,则禁用页面所有控件
            if (m_materieOutOrder.isReview == "1")
            {
                this.labelReviewBillStaff.Text = m_materieOutOrder.orderrReviewName;
                this.labelReviewDate.Text      = m_materieOutOrder.reviewDate;
                this.panelIsReview.Visible     = true;

                this.save.Enabled = false;
                this.toolStripButtonReview.Enabled = false;

                this.panelTradingDate.Visible          = false;
                this.dateTimePickerTradingDate.Visible = false;
                this.textBoxSummary.Visible            = false;

                this.dataGridViewDataList.ReadOnly  = true;
                this.dataGridViewDataCount.ReadOnly = true;
            }
            else
            {
                this.labelReviewBillStaff.Visible = false;
                this.labelReviewDate.Visible      = false;
            }

            if (m_materieOutOrder.isRedBill == 1)
            {
                m_isRedBill           = true;
                this.panelRed.Visible = true;
            }
        }
Exemple #4
0
 private void toolStripButtonReview_Click(object sender, EventArgs e)
 {
     try
     {
         save_Click(sender, e);
         MaterielOutOtherOrder.getInctance().billReview(m_billNumber, m_isRedBill);
     }
     catch (Exception exp)
     {
         MessageBoxExtend.messageError(exp.ToString());
     }
 }
Exemple #5
0
        private void save_Click(object sender, EventArgs e)
        {
            m_isSaveSuccess = false;

            if ((sender.ToString() == "保存" || sender.ToString() == "审核") &&
                MaterielOutOtherOrder.getInctance().checkBillIsReview(this.labelBillNumber.Text.ToString()))
            {
                MessageBoxExtend.messageWarning("单据已被审核,所有数据无法进行更改,无法重复保存或审核\r\n请重新登录或手动刷新后查看单据详情");
                return;
            }

            this.ActiveControl = this.toolStrip1;

            // 得到详细的销售信息
            ArrayList dataList = getMaterielOutOtherOrderDetailsValue();

            if (dataList.Count > 0)
            {
                // 销售订单表头和表尾信息
                MaterielOutOtherOrderTable record = getMaterielOutOtherOrderValue();
                if (orderInfoIsFull(record) && orderDetailsIsFull(dataList))
                {
                    MaterielOutOtherOrder.getInctance().insert(record, false);
                    MaterielOutOtherOrderDetails.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("此单据不包含任何交易信息,单据保存失败.");
            }
        }
Exemple #6
0
        private void exportOtherOutData()
        {
            int startRowIndex = 6;
            // 采购入库单数据导出
            MaterielOutOtherOrderTable table = new MaterielOutOtherOrderTable();

            table = MaterielOutOtherOrder.getInctance().getMaterielOutOtherOrderInfoFromBillNumber(m_billNubmber);

            stringReplace(table.billNumber, "[1]");
            stringReplace(table.exchangesUnit, "[2]");
            stringReplace(table.makeOrderStaffName, "[3]");
            stringReplace(table.projectNo, "[5]");
            stringReplace(table.makeNo, "[6]");

            double sum = 0.0;

            for (int row = 0; row < m_dataGridView.RowCount; row++)
            {
                if (m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.MatetielNumber].Value.ToString().Length == 0)
                {
                    break;
                }

                int           materielID = Convert.ToInt32(m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.MatetielNumber].Value.ToString().Trim());
                MaterielTable record     = Materiel.getInctance().getMaterielInfoFromPkey(materielID);

                m_excelApp.Cells[row + startRowIndex, 2]  = materielID;
                m_excelApp.Cells[row + startRowIndex, 3]  = record.brand;
                m_excelApp.Cells[row + startRowIndex, 4]  = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.MatetielName].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex, 5]  = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.Model].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex, 7]  = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.Unit].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex, 8]  = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.Value].Value.ToString().Trim();
                m_excelApp.Cells[row + startRowIndex, 9]  = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_STORAGE_LIST", record.storage);
                m_excelApp.Cells[row + startRowIndex, 10] = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.Note].Value.ToString().Trim();

                sum += Convert.ToDouble(m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOtherOrder.DataGridColumnName.Value].Value.ToString().Trim());
            }

            stringReplace(Convert.ToString(sum), "[4]");
        }
Exemple #7
0
        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);
            }
        }
Exemple #8
0
        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);
        }