Example #1
0
        private void writeDataToCashCashsubLedger()
        {
            CashCashsubLedgerTable record = new CashCashsubLedgerTable();

            record.tradingDate    = this.dateTime.Value.ToString("yyyyMMdd");
            record.billNumber     = this.textBoxPaymentOrderNumber.Text;
            record.vouchersNumber = this.textBoxVouchersNumber.Text;
            record.billName       = PAYMENT_ORDER_BILL_NAME;
            record.billTypeID     = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialPkeyFromName("BASE_PAYMENT_TYPE_LIST", comboBoxPaymentType.Text);;

            if (this.comboBoxPaymentType.Text.IndexOf("采购入库") != -1)
            {
                // 如果是采购入库,则需要采集原始单据号
                record.sourceBillNumber = this.textBoxSourceOrderNumber.Text;
            }
            else if (this.comboBoxPaymentType.Text.IndexOf("应付") != -1)
            {
                // 如果是应付账款,则需要记录往来单位名称
                record.exchangesUnit = getExchangesUnitID();
            }
            else if (this.comboBoxPaymentType.Text.IndexOf("其他") != -1 || this.comboBoxPaymentType.Text.IndexOf("其它") != -1)
            {
                // 如果是其他付款,则需要记录其他付款条目到备注字段
                record.note = this.textBoxSourceOrderNumber.Text;
            }

            record.turnover       = Convert.ToDouble(this.textBoxTransactionAmount.Text);
            record.makeOrderStaff = DbPublic.getInctance().getCurrentLoginUserID();

            CashCashsubLedger.getInctance().insert(record);
        }
Example #2
0
        private void toolStripButtonReview_Click(object sender, EventArgs e)
        {
            /*
             * 函数实现逻辑
             * 1、检查界面数据有效性
             * 1、查看付款单类型是否是应收账款,如果是,则根据供应商ID,更新应付账款表
             * 2、根据付款方科目是现金或银行存款,计算本次交易完成后对应账户的余额
             * 3、更新相应表的IS_REVIEW字段
             * 4、提示保存成功,如果保存失败,提示保存失败的原因
             * */

            if (DbPublic.getInctance().isCheckOut())
            {
                MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,无法再审核单据!");
                return;
            }

            if (!checkUiValue())
            {
                return;
            }
            ;

            if (m_billNumber.Length > 0)
            {
                if (m_isBankBill)
                {
                    double currentSystemBankBalance = BalanceManager.getBankBalance(m_bankRecord.bankName);
                    BankCashsubLedger.getInctance().update(
                        m_billNumber,
                        DbPublic.getInctance().getCurrentLoginUserID(),
                        m_bankRecord.turnover + currentSystemBankBalance);
                }
                else
                {
                    double currentSystemCachBalance = BalanceManager.getCachBalance();

                    CashCashsubLedger.getInctance().update(
                        m_billNumber,
                        DbPublic.getInctance().getCurrentLoginUserID(),
                        m_cashRecord.turnover + currentSystemCachBalance);
                }


                if (this.comboBoxReceivableType.Text.IndexOf("应收") != -1)
                {
                    updateAccountReceivable();
                }
                else if (this.comboBoxReceivableType.Text.IndexOf("销售出库") != -1)
                {
                    SaleOutOrder.getInctance().updataReceivedInfo(this.textBoxSourceOrderNumber.Text.ToString(),
                                                                  Convert.ToDouble(textBoxTransactionAmount.Text.ToString()));
                }

                MessageBoxExtend.messageOK("审核成功.");
                OperatorLog.getInctance().insert(501, "单据审核[" + m_billNumber + "]");
                this.Close();
            }
        }
Example #3
0
        private SortedDictionary <string, ReceivablerAndPaymentOrderTable> getAllOrderFromOrderName(string orderName)
        {
            SortedDictionary <string, ReceivablerAndPaymentOrderTable> receivablerAndPaymentOrderList =
                new SortedDictionary <string, ReceivablerAndPaymentOrderTable>();

            // 查询现金账中所有指定类型单据
            SortedDictionary <int, CashCashsubLedgerTable> cashCashsubLedgerList =
                CashCashsubLedger.getInctance().getAllReviewCashCashsubLedgerInfo();

            foreach (KeyValuePair <int, CashCashsubLedgerTable> index in cashCashsubLedgerList)
            {
                if (index.Value.billName == orderName)
                {
                    ReceivablerAndPaymentOrderTable record = new ReceivablerAndPaymentOrderTable();

                    record.pkey               = index.Value.pkey;
                    record.tradingDate        = index.Value.tradingDate;
                    record.makeOrderStaffName = index.Value.makeOrderStaffName;
                    record.orderReviewName    = index.Value.orderReviewName;
                    record.turnover           = index.Value.turnover;
                    record.billNumber         = index.Value.billNumber;
                    record.billTypeName       = index.Value.billTypeName;

                    receivablerAndPaymentOrderList.Add(record.billNumber, record);
                }
            }

            // 查询所有的银行账中所有指定类型的单据
            SortedDictionary <int, BankCashsubLedgerTable> bankCashsubLedgerList =
                BankCashsubLedger.getInctance().getAllReviewBankCashsubLedgerInfo();

            foreach (KeyValuePair <int, BankCashsubLedgerTable> indexbank in bankCashsubLedgerList)
            {
                if (indexbank.Value.billName == orderName)
                {
                    ReceivablerAndPaymentOrderTable record = new ReceivablerAndPaymentOrderTable();

                    record.pkey               = indexbank.Value.pkey;
                    record.tradingDate        = indexbank.Value.tradingDate;
                    record.makeOrderStaffName = indexbank.Value.makeOrderStaffName;
                    record.orderReviewName    = indexbank.Value.orderReviewName;
                    record.turnover           = indexbank.Value.turnover;
                    record.billNumber         = indexbank.Value.billNumber;
                    record.billTypeName       = indexbank.Value.billTypeName;

                    receivablerAndPaymentOrderList.Add(record.billNumber, record);
                }
            }

            return(receivablerAndPaymentOrderList);
        }
Example #4
0
        private void openBillFromBillNumber(string billNumber)
        {
            if (m_billNumber.Length > 0)
            {
                bool isCashBill = CashCashsubLedger.getInctance().checkBillIsExist(m_billNumber);

                if (m_isReceivablerOrder)
                {
                    FormReceivableOrder fro = new FormReceivableOrder(m_billNumber, !isCashBill);
                    fro.ShowDialog();
                }
                else
                {
                    FormPaymentOrder fpo = new FormPaymentOrder(m_billNumber, !isCashBill);
                    fpo.ShowDialog();
                }
            }
        }
Example #5
0
        private void initUserInterfaceValue()
        {
            if (m_isBankBill)
            {
                m_bankRecord = BankCashsubLedger.getInctance().getBankCashsubLedgerInfoFromOrderNumber(m_billNumber);

                // 如果单据已审核,则允许用户修改此单据
                if (m_bankRecord.isReview == "1")
                {
                    setAllActiveEnableAttribute(false);
                }

                this.textBoxPaymentOrderNumber.Text = m_bankRecord.billNumber;
                this.textBoxVouchersNumber.Text     = m_bankRecord.vouchersNumber;
                this.dateTime.Text = m_bankRecord.tradingDate;

                this.comboBoxPaymentType.Text = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_PAYMENT_TYPE_LIST", m_bankRecord.billTypeID);
                comboBoxPaymentType_SelectedIndexChanged(this.comboBoxPaymentType, null);

                if (this.comboBoxPaymentType.Text.IndexOf("采购入库") != -1)
                {
                    this.textBoxSourceOrderNumber.Text = m_bankRecord.sourceBillNumber;
                }
                else if (this.comboBoxPaymentType.Text.IndexOf("应付") != -1)
                {
                    this.textBoxSourceOrderNumber.Text = m_bankRecord.exchangesUnitName;
                }
                else if (this.comboBoxPaymentType.Text.IndexOf("其他") != -1 || this.comboBoxPaymentType.Text.IndexOf("其它") != -1)
                {
                    this.textBoxSourceOrderNumber.Text = m_bankRecord.note;
                }
                this.comboBoxPaymentObject.Text = "银行存款";
                this.comboBoxBank.Text          = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_BANK_LIST", m_bankRecord.bankID);
                comboBoxPaymentObject_SelectedIndexChanged(this.comboBoxPaymentObject, null);

                this.textBoxTransactionAmount.Text = Convert.ToString(m_bankRecord.turnover);
                this.textBoxMakeOrderStaff.Text    = m_bankRecord.makeOrderStaffName;
                this.textBoxOrderReview.Text       = m_bankRecord.orderReviewName;
            }
            else
            {
                m_cashRecord = CashCashsubLedger.getInctance().getCashCashsubLedgerInfoFromOrderNumber(m_billNumber);

                // 如果单据已审核,则允许用户修改此单据
                if (m_cashRecord.isReview == "1")
                {
                    setAllActiveEnableAttribute(false);
                }

                this.textBoxPaymentOrderNumber.Text = m_cashRecord.billNumber;
                this.textBoxVouchersNumber.Text     = m_cashRecord.vouchersNumber;
                this.dateTime.Text = m_cashRecord.tradingDate;

                this.comboBoxPaymentType.Text = AuxiliaryMaterial.getInctance().getAuxiliaryMaterialNameFromPkey("BASE_PAYMENT_TYPE_LIST", m_cashRecord.billTypeID);
                comboBoxPaymentType_SelectedIndexChanged(this.comboBoxPaymentType, null);

                if (this.comboBoxPaymentType.Text.IndexOf("采购入库") != -1)
                {
                    this.textBoxSourceOrderNumber.Text = m_cashRecord.sourceBillNumber;
                }
                else if (this.comboBoxPaymentType.Text.IndexOf("应付") != -1)
                {
                    this.textBoxSourceOrderNumber.Text = m_cashRecord.exchangesUnitName;
                }
                else if (this.comboBoxPaymentType.Text.IndexOf("其他") != -1 || this.comboBoxPaymentType.Text.IndexOf("其它") != -1)
                {
                    this.textBoxSourceOrderNumber.Text = m_cashRecord.note;
                }
                this.comboBoxPaymentObject.Text    = "库存现金";
                this.textBoxTransactionAmount.Text = Convert.ToString(m_cashRecord.turnover);
                this.textBoxMakeOrderStaff.Text    = m_cashRecord.makeOrderStaffName;
                this.textBoxOrderReview.Text       = m_cashRecord.orderReviewName;
            }
        }
Example #6
0
        private void toolStripButtonReview_Click(object sender, EventArgs e)
        {
            /*
             * 函数实现逻辑
             * 1、检查界面数据有效性
             * 1、查看付款单类型是否是应付账款,如果是,则根据供应商ID,更新应付账款表
             * 2、根据付款方科目是现金或银行存款,计算本次交易完成后对应账户的余额
             * 3、更新相应表的IS_REVIEW字段
             * 4、提示保存成功,如果保存失败,提示保存失败的原因
             * */

            if (DbPublic.getInctance().isCheckOut())
            {
                MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,无法再审核单据!");
                return;
            }

            if (!checkUiValue())
            {
                return;
            }
            ;

            if (m_billNumber.Length > 0)
            {
                if (m_isBankBill)
                {
                    double currentSystemBankBalance = BalanceManager.getBankBalance(m_bankRecord.bankName);

                    if (m_bankRecord.turnover > currentSystemBankBalance)
                    {
                        string msg = "付款交易失败\n";
                        msg += "[" + m_bankRecord.bankName + "]余额为:";
                        msg += Convert.ToString(currentSystemBankBalance) + ",不足以完成本次支付.";
                        MessageBoxExtend.messageWarning(msg);
                        return;
                    }
                    else
                    {
                        BankCashsubLedger.getInctance().update(
                            m_billNumber,
                            DbPublic.getInctance().getCurrentLoginUserID(),
                            currentSystemBankBalance - m_bankRecord.turnover);
                    }
                }
                else
                {
                    double currentSystemCachBalance = BalanceManager.getCachBalance();

                    if (m_cashRecord.turnover > currentSystemCachBalance)
                    {
                        string msg = "付款交易失败\n";
                        msg += "库存现金余额为:";
                        msg += Convert.ToString(currentSystemCachBalance) + ",不足以完成本次支付.";
                        MessageBoxExtend.messageWarning(msg);
                        return;
                    }
                    else
                    {
                        CashCashsubLedger.getInctance().update(
                            m_billNumber,
                            DbPublic.getInctance().getCurrentLoginUserID(),
                            currentSystemCachBalance - m_cashRecord.turnover);
                    }
                }

                if (this.comboBoxPaymentType.Text.IndexOf("应付") != -1)
                {
                    updateAccountPayment();
                }
                else if (this.comboBoxPaymentType.Text.IndexOf("采购入库") != -1)
                {
                    PurchaseInOrder.getInctance().updataPaymentInfo(this.textBoxSourceOrderNumber.Text.ToString(),
                                                                    Convert.ToDouble(textBoxTransactionAmount.Text.ToString()));
                }

                MessageBoxExtend.messageOK("审核成功.");
                OperatorLog.getInctance().insert(502, "单据审核[" + m_billNumber + "]");
                this.Close();
            }
        }
Example #7
0
        private void updateDataGridView(bool isALLTableData)
        {
            SortedDictionary <int, ArrayList> sortedDictionaryList = new SortedDictionary <int, ArrayList>();

            if (m_isCashDetail)
            {
                SortedDictionary <int, CashCashsubLedgerTable> cashDetail = new SortedDictionary <int, CashCashsubLedgerTable>();

                if (isALLTableData)
                {
                    cashDetail = CashCashsubLedger.getInctance().getAllCashCashsubLedgerInfo();
                }
                else
                {
                    cashDetail = CashCashsubLedger.getInctance().getAllReviewCashCashsubLedgerInfo();
                }

                m_dataGridRecordCount = cashDetail.Count;

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

                    ArrayList temp = new ArrayList();

                    temp.Add(record.pkey);
                    temp.Add(record.tradingDate);
                    temp.Add(record.billName);
                    temp.Add(record.billNumber);
                    temp.Add(record.billTypeName);
                    temp.Add(record.exchangesUnitName);
                    temp.Add(record.turnover);
                    temp.Add(record.balance);
                    temp.Add(record.makeOrderStaffName);
                    temp.Add(record.orderReviewName);

                    sortedDictionaryList.Add(index, temp);
                }

                m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
            }
            else
            {
                SortedDictionary <int, BankCashsubLedgerTable> bankDetail = new SortedDictionary <int, BankCashsubLedgerTable>();

                if (isALLTableData)
                {
                    bankDetail = BankCashsubLedger.getInctance().getAllBankCashsubLedgerInfo();
                }
                else
                {
                    bankDetail = BankCashsubLedger.getInctance().getAllReviewBankCashsubLedgerInfo();
                }

                m_dataGridRecordCount = bankDetail.Count;

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

                    ArrayList temp = new ArrayList();

                    temp.Add(record.pkey);
                    temp.Add(record.tradingDate);
                    temp.Add(record.billName);
                    temp.Add(record.billNumber);
                    temp.Add(record.billTypeName);
                    temp.Add(record.exchangesUnitName);
                    temp.Add(record.turnover);
                    temp.Add(record.bankName);
                    temp.Add(record.balance);
                    temp.Add(record.makeOrderStaffName);
                    temp.Add(record.orderReviewName);

                    sortedDictionaryList.Add(index, temp);
                }

                m_dateGridViewExtend.initDataGridViewData(sortedDictionaryList, 3);
            }
        }