Esempio n. 1
0
        private void import_Click(object sender, EventArgs e)
        {
            string msg;

            if (m_isAccountReceivable)
            {
                msg = "批量导入数据会清空数据库所有已存在应收账款记录,是否继续?";
            }
            else
            {
                msg = "批量导入数据会清空数据库所有已存在应付账款记录,是否继续?";
            }

            if (MessageBoxExtend.messageQuestion(msg))
            {
                // 指定OpenFileDialog控件打开的文件格式
                openFileDialog1.Filter   = "导入文件(*.xls)|*.xls";
                openFileDialog1.FileName = "";

                if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
                {
                    if (m_isAccountReceivable)
                    {
                        InitAccountReceivable.getInctance().fileImport(openFileDialog1.FileName);
                    }
                    else
                    {
                        InitAccountPayable.getInctance().fileImport(openFileDialog1.FileName);
                    }
                    updateDataGridView();
                }
            }
        }
Esempio n. 2
0
        private void modify_Click(object sender, EventArgs e)
        {
            userInterfaceValue uiValue = new userInterfaceValue();

            uiValue.winText             = this.Text + "编辑";
            uiValue.isAccountReceivable = m_isAccountReceivable;
            uiValue.isEditDate          = true;
            uiValue.textBoxText         = m_currentDataGridViedRecordName;
            uiValue.pkey = m_currentDataGridViedRecordPkey;

            InitAccountReceivableTable data = new InitAccountReceivableTable();

            if (m_isAccountReceivable)
            {
                data = InitAccountReceivable.getInctance().getAccountReceivableInfoFromPkey(m_currentDataGridViedRecordPkey);
            }
            else
            {
                data = InitAccountPayable.getInctance().getAccountPayableInfoFromPkey(m_currentDataGridViedRecordPkey);
            }

            uiValue.textBoxBalance         = Convert.ToString(data.balance);
            uiValue.dateTimePickerDateText = data.tradingDate;
            uiValue.customerOrSupplierID   = data.customerOrSupplierID;

            FormAccountReceivablerEdit fare = new FormAccountReceivablerEdit(uiValue);

            fare.ShowDialog();

            updateDataGridView();
        }
        private void checkAccountBillDetaile()
        {
            // checkAccountBillDetaile函数需要完成弹出一个新的窗口,用来显示公司跟该企业的详细的往来账

            if (m_currentDataGridViedRecordPkey != 0)
            {
                // 根据m_currentDataGridViedRecordPkey得到对应往来单位的pkey值
                int    exchangesUnitPkey;
                string winText = "";;

                if (m_isAccountReceivable)
                {
                    exchangesUnitPkey = InitAccountReceivable.getInctance().getCustomerOrSupplierIDFromPkey(m_currentDataGridViedRecordPkey);
                    winText           = "应收账款 - [" + m_currentDataGridViedRecordName + "]";
                }
                else
                {
                    exchangesUnitPkey = InitAccountPayable.getInctance().getCustomerOrSupplierIDFromPkey(m_currentDataGridViedRecordPkey);
                    winText           = "应付账款 - [" + m_currentDataGridViedRecordName + "]";
                }

                if (exchangesUnitPkey != -1)
                {
                    FormAccountReceivablerDetail fard = new FormAccountReceivablerDetail(winText, m_isAccountReceivable, exchangesUnitPkey);
                    fard.ShowDialog();
                }
                else
                {
                    MessageBoxExtend.messageWarning("该企业不存在.");
                }
            }
        }
Esempio n. 4
0
        private void updateDataGridView()
        {
            SortedDictionary <int, InitAccountReceivableTable> dateList = new SortedDictionary <int, InitAccountReceivableTable>();

            if (m_isAccountReceivable)
            {
                dateList = InitAccountReceivable.getInctance().getAllInitAccountReceivableInfo();
            }
            else
            {
                dateList = InitAccountPayable.getInctance().getAllInitAccountPayableInfo();
            }

            m_dataGridRecordCount = dateList.Count;

            SortedDictionary <int, ArrayList> settlmentWayLArrary = new SortedDictionary <int, ArrayList>();

            double balanceSum = 0.0, creditSum = 0.0;
            int    recordCount = 0;

            for (recordCount = 0; recordCount < dateList.Count; recordCount++)
            {
                InitAccountReceivableTable record = new InitAccountReceivableTable();
                record = (InitAccountReceivableTable)dateList[recordCount];

                ArrayList temp = new ArrayList();

                temp.Add(record.pkey);
                temp.Add(record.customerOrSupplierID);
                temp.Add(record.name);
                temp.Add(record.balance);
                temp.Add(record.tradingDate);
                temp.Add(record.credit);

                settlmentWayLArrary.Add(recordCount, temp);

                // 应收或应付账款金额合计
                balanceSum += record.balance;
                creditSum  += record.credit;
            }

            m_dateGridViewExtend.initDataGridViewData(settlmentWayLArrary);
        }
Esempio n. 5
0
        private void delete_Click(object sender, EventArgs e)
        {
            if (m_currentDataGridViedRecordPkey != 0)
            {
                if (MessageBoxExtend.messageQuestion("确定删除[" + m_currentDataGridViedRecordName + "]欠款信息吗?"))
                {
                    if (m_isAccountReceivable)
                    {
                        InitAccountReceivable.getInctance().delete(m_currentDataGridViedRecordPkey);
                    }
                    else
                    {
                        InitAccountPayable.getInctance().delete(m_currentDataGridViedRecordPkey);
                    }

                    updateDataGridView();
                }
            }
        }
        private void updateDataGridView()
        {
            SortedDictionary <int, InitAccountReceivableTable> dateList = new SortedDictionary <int, InitAccountReceivableTable>();

            if (m_isAccountReceivable)
            {
                dateList = InitAccountReceivable.getInctance().getAllInitAccountReceivableInfo();
            }
            else
            {
                dateList = InitAccountPayable.getInctance().getAllInitAccountPayableInfo();
            }

            m_dataGridRecordCount = dateList.Count;

            SortedDictionary <int, ArrayList> settlmentWayLArrary = new SortedDictionary <int, ArrayList>();

            double balanceSum = 0.0, creditSum = 0.0;
            int    recordCount = 0;

            for (recordCount = 0; recordCount < dateList.Count; recordCount++)
            {
                InitAccountReceivableTable record = new InitAccountReceivableTable();
                record = (InitAccountReceivableTable)dateList[recordCount];

                ArrayList temp = new ArrayList();

                temp.Add(record.pkey);
                temp.Add(record.name);
                temp.Add(record.balance);
                temp.Add(record.tradingDate);
                temp.Add(record.credit);

                settlmentWayLArrary.Add(recordCount, temp);

                // 应收或应付账款金额合计
                balanceSum += record.balance;
                creditSum  += record.credit;
            }

            // 需要再DataGridView的最后一行添加合计欠款金额一行
            InitAccountReceivableTable sumBalanceRecord = new InitAccountReceivableTable();

            sumBalanceRecord.pkey        = 0;
            sumBalanceRecord.name        = "合计";
            sumBalanceRecord.balance     = balanceSum;
            sumBalanceRecord.tradingDate = "";
            sumBalanceRecord.credit      = creditSum;

            ArrayList sumRecord = new ArrayList();

            sumRecord.Add(sumBalanceRecord.pkey);
            sumRecord.Add(sumBalanceRecord.name);
            sumRecord.Add(sumBalanceRecord.balance);
            sumRecord.Add(sumBalanceRecord.tradingDate);
            sumRecord.Add(sumBalanceRecord.credit);

            settlmentWayLArrary.Add(recordCount, sumRecord);

            m_dateGridViewExtend.initDataGridViewData(settlmentWayLArrary);

            // 设置DataGridView 合计行背景颜色
            dataGridViewList.Rows[dateList.Count].DefaultCellStyle.BackColor = System.Drawing.Color.LightBlue;
        }
Esempio n. 7
0
        private void buttonEnter_Click(object sender, EventArgs e)
        {
            if (textBoxBalance.Text.Length == 0)
            {
                MessageBoxExtend.messageWarning("欠款金额不能为空");
                return;
            }

            if (textBoxBalance.Text.Length > 20)
            {
                MessageBoxExtend.messageWarning("单价最大长度不能超过10");
                textBoxBalance.Text = "";
                return;
            }

            if (dateTimePickerDate.Text.Length == 0)
            {
                MessageBoxExtend.messageWarning("日期不能");
                return;
            }

            InitAccountReceivableTable record = new InitAccountReceivableTable();

            if (m_userInterfaceValue.isEditDate)
            {
                record.customerOrSupplierID = m_userInterfaceValue.customerOrSupplierID;
            }
            else
            {
                record.customerOrSupplierID = m_selectRecordPkey;
            }

            record.balance     = Convert.ToDouble(this.textBoxBalance.Text.ToString());
            record.tradingDate = this.dateTimePickerDate.Value.ToString("yyyyMMdd");

            if (m_userInterfaceValue.isEditDate)
            {
                if (m_userInterfaceValue.isAccountReceivable)
                {
                    InitAccountReceivable.getInctance().update(m_userInterfaceValue.pkey, record);
                }
                else
                {
                    InitAccountPayable.getInctance().update(m_userInterfaceValue.pkey, record);
                }
            }
            else
            {
                if (m_userInterfaceValue.isAccountReceivable)
                {
                    InitAccountReceivable.getInctance().insert(record);
                }
                else
                {
                    InitAccountPayable.getInctance().insert(record);
                }
            }

            m_isAddToInitList = true;
            this.Close();
        }