Пример #1
0
        private void toolStripButtonReview_Click(object sender, EventArgs e)
        {
            try
            {
                save_Click(sender, e);

                if (m_isSaveSuccess)
                {
                    TivLog.Logger.Info("开始审核单据:" + m_billNumber);

                    bool isRet = MaterielOutOrder.getInctance().billReview(m_billNumber, m_isRedBill);

                    // 自动消除库存占用
                    if (isRet)
                    {
                        AutoDelMateriePro(m_billNumber);
                    }

                    TivLog.Logger.Info("单据审核完成:" + m_billNumber);
                }
            }
            catch (Exception exp)
            {
                MessageBoxExtend.messageError(exp.ToString());
            }
        }
Пример #2
0
        private void save_Click(object sender, EventArgs e)
        {
            // 得到详细的销售信息
            ArrayList dataList = getMaterielOutOrderDetailsValue();

            if (dataList.Count > 0)
            {
                // 销售订单表头和表尾信息
                MaterielOutOrderTable record = getMaterielOutOrderValue();
                if (orderInfoIsFull(record) && orderDetailsIsFull(dataList))
                {
                    MaterielOutOrder.getInctance().insert(record, false);
                    MaterielOutOrderDetails.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("此单据不包含任何交易信息,单据保存失败.");
            }
        }
Пример #3
0
        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();
        }
Пример #4
0
 private void toolStripButtonReview_Click(object sender, EventArgs e)
 {
     try
     {
         save_Click(sender, e);
         MaterielOutOrder.getInctance().billReview(m_billNumber, m_isRedBill);
     }
     catch (Exception exp)
     {
         MessageBoxExtend.messageError(exp.ToString());
     }
 }
Пример #5
0
        private void save_Click(object sender, EventArgs e)
        {
            m_isSaveSuccess = false;

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

            this.ActiveControl = this.toolStrip1;

            bool isReLoad = true;

            if (sender == null && e == null)
            {
                isReLoad = false;
            }

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

            if (dataList.Count > 0)
            {
                // 销售订单表头和表尾信息
                MaterielOutOrderTable record = getMaterielOutOrderValue();
                if (orderInfoIsFull(record) && orderDetailsIsFull(dataList))
                {
                    MaterielOutOrder.getInctance().insert(record, false, isReLoad);
                    MaterielOutOrderDetails.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("此单据不包含任何交易信息,单据保存失败.");
            }
        }
Пример #6
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);
            }
        }
Пример #7
0
        private void readBillInfoToUI()
        {
            // 单据表头表尾信息
            m_materieOutOrder = MaterielOutOrder.getInctance().getMaterielOutOrderInfoFromBillNumber(m_billNumber);

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

            this.labelSaleName.Visible        = true;
            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.labelSaleName.Text      = m_materieOutOrder.departmentName;
            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.panelDepartmentName.Visible = false;
                this.panelTradingDate.Visible    = false;

                this.textBoxDepartmentName.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;
            }
        }
Пример #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);
        }
Пример #9
0
        private void exportMaterielOutData()
        {
            // 生产领料单数据导出
            MaterielOutOrderTable table = new MaterielOutOrderTable();

            table = MaterielOutOrder.getInctance().getMaterielOutOrderInfoFromBillNumber(m_billNubmber);

            FormProjectMaterielTable projectInfo = FormProject.getInctance().getProjectInfoFromBillNumber(table.srcOrderNum);

            stringReplace(projectInfo.projectName, "[1]");
            stringReplace(table.billNumber, "[2]");
            stringReplace(table.srcOrderNum, "[3]");
            stringReplace(table.makeNo, "[4]");
            stringReplace(table.exchangesUnit, "[5]");
            stringReplace(projectInfo.projectNum, "[6]");
            stringReplace(table.makeOrderStaffName, "[7]");
            stringReplace(projectInfo.deviceMode, "[9]");
            stringReplace(projectInfo.subName, "[10]");

            double sum = 0.0;

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

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

                ProjectManagerDetailsTable tmp = new ProjectManagerDetailsTable();

                string xxMatetielTableRowNum = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.xxMatetielTableRowNum].Value.ToString();

                if (xxMatetielTableRowNum.Length > 0)
                {
                    tmp = ProjectManagerDetails.getInctance().getMaterielInfoFromRowNum(table.srcOrderNum, Convert.ToInt32(xxMatetielTableRowNum));
                }
                else
                {
                    tmp = ProjectManagerDetails.getInctance().getMaterielInfoFromBillNumber(table.srcOrderNum, materielID);
                }

                m_excelApp.Cells[row + 6, 1] = tmp.no;
                m_excelApp.Cells[row + 6, 2] = tmp.sequence;
                m_excelApp.Cells[row + 6, 3] = record.brand;
                m_excelApp.Cells[row + 6, 4] = record.name;
                m_excelApp.Cells[row + 6, 5] = record.model;

                m_excelApp.Cells[row + 6, 6] = tmp.cl;
                m_excelApp.Cells[row + 6, 7] = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Unit].Value.ToString().Trim();

                m_excelApp.Cells[row + 6, 8]  = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Value].Value.ToString().Trim();
                m_excelApp.Cells[row + 6, 9]  = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_STORAGE_LIST", record.storage);
                m_excelApp.Cells[row + 6, 10] = m_dataGridView.Rows[row].Cells[(int)FormMaterielOutOrder.DataGridColumnName.Note].Value.ToString().Trim();

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

            stringReplace(Convert.ToString(sum), "[8]");
        }
Пример #10
0
        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);
                }
            }
        }