Exemplo n.º 1
0
        private bool purchaseOrderDetailsIsFull(ArrayList list)
        {
            bool isRet = true;

            for (int rowIndex = 0; rowIndex < list.Count; rowIndex++)
            {
                PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable();
                record = (PurchaseInOrderDetailsTable)list[rowIndex];

                //string price = Convert.ToString(record.price);
                //string value = Convert.ToString(record.value);

                if (record.price == 0)
                {
                    MessageBoxExtend.messageWarning("第[" + record.rowNumber + "]信息中物料单价不能为空");
                    isRet = false;
                    break;
                }

                if (record.value == 0)
                {
                    MessageBoxExtend.messageWarning("第[" + record.rowNumber + "]信息中物料数量不能为空");
                    isRet = false;
                    break;
                }
            }

            return(isRet);
        }
Exemplo n.º 2
0
        private ArrayList getPurchaseInOrderDetailsValue()
        {
            ArrayList list = new ArrayList();

            for (int rowIndex = 0; rowIndex < DateGridVeiwListDataListRowCount; rowIndex++)
            {
                if (this.dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value.ToString().Length == 0)
                {
                    break;
                }
                else
                {
                    PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable();

                    record.rowNumber            = dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.RowNum].Value.ToString();
                    record.materielID           = Convert.ToInt32(dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value.ToString());
                    record.price                = Convert.ToDouble(dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Price].Value.ToString());
                    record.value                = Convert.ToDouble(dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value.ToString());
                    record.costApportionments   = Convert.ToDouble(dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.TransportationCost].Value.ToString());
                    record.noCostApportionments = Convert.ToDouble(dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.OtherCost].Value.ToString());
                    record.billNumber           = this.labelBillNumber.Text;

                    list.Add(record);
                }
            }

            return(list);
        }
Exemplo n.º 3
0
        private SortedDictionary <int, ArrayList> getPurchaseMaterielData(out double sumTotleMoney)
        {
            SortedDictionary <int, ArrayList> sortedDictionaryList   = new SortedDictionary <int, ArrayList>();
            SortedDictionary <int, PurchaseInOrderDetailsTable> list = new SortedDictionary <int, PurchaseInOrderDetailsTable>();

            list = PurchaseInOrderDetails.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill);

            m_dataGridRecordCount = list.Count;
            sumTotleMoney         = getSumTotleMoney(list);

            for (int index = 0; index < list.Count; index++)
            {
                PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable();
                record = (PurchaseInOrderDetailsTable)list[index];

                ArrayList temp = new ArrayList();

                temp.Add(index + 1);
                temp.Add(record.materielID);
                temp.Add(record.materielName);
                temp.Add(record.materielModel);
                temp.Add(record.totalMoney);
                temp.Add(getPercentValue(record.totalMoney, sumTotleMoney));

                sortedDictionaryList.Add(index, temp);
            }

            return(sortedDictionaryList);
        }
Exemplo n.º 4
0
        private double getSumTotleMoney(SortedDictionary <int, PurchaseInOrderDetailsTable> list)
        {
            double sumTotleMoney = 0.0;

            for (int index = 0; index < list.Count; index++)
            {
                PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable();
                record         = (PurchaseInOrderDetailsTable)list[index];
                sumTotleMoney += record.totalMoney;
            }
            return(sumTotleMoney);
        }
Exemplo n.º 5
0
        private void readBillInfoToUI()
        {
            // 单据表头表尾信息
            m_purchaseInOrder = PurchaseInOrder.getInctance().getPurchaseInfoFromBillNumber(m_billNumber);

            m_supplierPkey   = m_purchaseInOrder.supplierId;
            m_staffSavePkey  = m_purchaseInOrder.staffSaveId;
            m_staffCheckPkey = m_purchaseInOrder.staffCheckId;

            this.labelPurchaseName.Visible      = true;
            this.labelTradingDate.Visible       = true;
            this.labelBillNumber.Visible        = true;
            this.labelPurchaseType.Visible      = true;
            this.labelPaymentDate.Visible       = true;
            this.labelSummary.Visible           = true;
            this.labelBusinessPeople.Visible    = true;
            this.labelMakeBillStaff.Visible     = true;
            this.labelReviewBillStaff.Visible   = true;
            this.labelReviewDate.Visible        = true;
            this.labelSourceOrderType.Visible   = true;
            this.labelSourceOrderNumber.Visible = true;
            this.labelSave.Visible        = true;
            this.labelVerify.Visible      = true;
            this.labelContractNum.Visible = true;

            this.labelPurchaseName.Text = m_purchaseInOrder.supplierName;
            this.labelTradingDate.Text  = m_purchaseInOrder.tradingDate;
            this.labelBillNumber.Text   = m_purchaseInOrder.billNumber;
            this.labelContractNum.Text  = m_purchaseInOrder.contractNum;
            this.labelPurchaseType.Text = m_purchaseInOrder.purchaseType;
            this.labelPaymentDate.Text  = m_purchaseInOrder.paymentDate;
            this.labelSummary.Text      = m_purchaseInOrder.exchangesUnit;

            m_staffPkey = m_purchaseInOrder.businessPeopleId;
            this.labelBusinessPeople.Text = m_purchaseInOrder.businessPeopleName;
            this.labelMakeBillStaff.Text  = m_purchaseInOrder.makeOrderStaffName;

            this.labelSourceOrderType.Text   = m_purchaseInOrder.sourceBillType;
            this.labelSourceOrderNumber.Text = m_purchaseInOrder.sourceBillNumber;
            this.labelSave.Text        = m_purchaseInOrder.staffSaveName;
            this.labelVerify.Text      = m_purchaseInOrder.staffCheckName;
            this.labelContractNum.Text = m_purchaseInOrder.contractNum;


            // DataGridView 赋值
            SortedDictionary <int, PurchaseInOrderDetailsTable> purchaseOrderDetails =
                PurchaseInOrderDetails.getInctance().getPurchaseInfoFromBillNumber(m_billNumber);

            foreach (KeyValuePair <int, PurchaseInOrderDetailsTable> index in purchaseOrderDetails)
            {
                PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable();
                record = index.Value;

                int rowIndex = Convert.ToInt32(record.rowNumber.ToString()) - 1;

                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value     = record.materielID;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielName].Value       = record.materielName;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Model].Value              = record.materielModel;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Brand].Value              = record.brand;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Unit].Value               = record.materielUnitPurchase;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Price].Value              = record.price;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Value].Value              = record.value;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.Turnover].Value           = record.sumMoney;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.TransportationCost].Value = record.costApportionments;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.OtherCost].Value          = record.noCostApportionments;
                dataGridViewDataList.Rows[rowIndex].Cells[(int)DataGridColumnName.SumTurnover].Value        = record.totalMoney;
            }

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

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

                this.panelPurchaseName.Visible = false;
                this.panelTradingDate.Visible  = false;
                this.panelPurchaseType.Visible = false;
                this.panelPaymentDate.Visible  = false;
                this.panelSummary.Visible      = false;

                this.textBoxPurchaseName.Visible       = false;
                this.dateTimePickerTradingDate.Visible = false;
                this.comboBoxPurchaseType.Visible      = false;
                this.dateTimePickerPaymentDate.Visible = false;
                this.textBoxSummary.Visible            = false;

                this.panelBusinessPeople.Visible = false;

                this.registerInLedger.Enabled = true;
                this.redBill.Enabled          = false;
                this.blueBill.Enabled         = false;
            }
            else
            {
                this.labelReviewBillStaff.Visible = false;
                this.labelReviewDate.Visible      = false;
                this.registerInLedger.Enabled     = false;
            }

            // 如果单据已经记账,则出来红字已记账提示
            if (m_purchaseInOrder.isInLedger == 1)
            {
                this.panelInLedger.Visible          = true;
                this.registerInLedger.Enabled       = false;
                this.dataGridViewDataList.ReadOnly  = true;
                this.dataGridViewDataCount.ReadOnly = true;
            }
            else
            {
                this.dataGridViewDataList.Enabled  = true;
                this.dataGridViewDataCount.Enabled = true;
            }

            if (m_purchaseInOrder.isRedBill == 1)
            {
                m_isRedBill           = true;
                this.panelRed.Visible = true;
            }
        }
Exemplo n.º 6
0
        private void updateDataGridView()
        {
            double sumTotleMoney = 0;
            SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>();
            int index = 0;

            if (m_orderType == CountType.Materiel)
            {
                SortedDictionary <int, PurchaseInOrderDetailsTable> list = new SortedDictionary <int, PurchaseInOrderDetailsTable>();

                list = PurchaseInOrderDetails.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill);

                m_dataGridRecordCount = list.Count;
                sumTotleMoney         = getSumTotleMoney(list);

                for (index = 0; index < list.Count; index++)
                {
                    PurchaseInOrderDetailsTable record = new PurchaseInOrderDetailsTable();
                    record = (PurchaseInOrderDetailsTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(index + 1);
                    temp.Add(record.materielID);
                    temp.Add(record.materielName);
                    temp.Add(record.materielModel);
                    temp.Add(record.totalMoney);
                    temp.Add(getPercentValue(record.totalMoney, sumTotleMoney));

                    sortedDictionaryList.Add(index, temp);
                }
            }
            else if (m_orderType == CountType.People)
            {
                SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>();

                list = PurchaseInOrder.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill, 2);

                m_dataGridRecordCount = list.Count;
                sumTotleMoney         = getSumTotleMoney(list);

                for (index = 0; index < list.Count; index++)
                {
                    PurchaseInOrderTable record = new PurchaseInOrderTable();
                    record = (PurchaseInOrderTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(index + 1);
                    temp.Add(record.businessPeopleId);
                    temp.Add(record.businessPeopleName);
                    temp.Add(record.totalMoney);
                    temp.Add(getPercentValue(Convert.ToDouble(record.totalMoney.ToString()), sumTotleMoney));

                    sortedDictionaryList.Add(index, temp);
                }
            }
            else if (m_orderType == CountType.Supplier)
            {
                SortedDictionary <int, PurchaseInOrderTable> list = new SortedDictionary <int, PurchaseInOrderTable>();

                list = PurchaseInOrder.getInctance().getPurchaseInOrderCountInfo(m_countStartDate, m_countEndDate, m_isCountAllBill, 1);

                m_dataGridRecordCount = list.Count;
                sumTotleMoney         = getSumTotleMoney(list);

                for (index = 0; index < list.Count; index++)
                {
                    PurchaseInOrderTable record = new PurchaseInOrderTable();
                    record = (PurchaseInOrderTable)list[index];

                    ArrayList temp = new ArrayList();

                    temp.Add(index + 1);
                    temp.Add(record.supplierId);
                    temp.Add(record.supplierName);
                    temp.Add(record.totalMoney);
                    temp.Add(getPercentValue(Convert.ToDouble(record.totalMoney.ToString()), sumTotleMoney));

                    sortedDictionaryList.Add(index, temp);
                }
            }

            // 添加合计行
            ArrayList sumRow = new ArrayList();

            sumRow.Add(index + 1);
            sumRow.Add("合计");
            sumRow.Add("");

            if (m_orderType == CountType.Materiel)
            {
                sumRow.Add("");
            }

            sumRow.Add(sumTotleMoney);

            sumRow.Add("100%");
            sortedDictionaryList.Add(index, sumRow);

            m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList);
            dataGridViewList.Rows[index].DefaultCellStyle.BackColor = System.Drawing.Color.LightBlue;


            // 更新状态栏信息
            updateStatusLable();
        }