private void  geTableHadeAndEndValue()
        {
            m_currentOrderInfo.deviceMode = this.labelDeviceMode.Text;

            m_currentOrderInfo.subName    = this.labelTradingDate.Text;
            m_currentOrderInfo.billNumber = this.labelBillNumber.Text;

            m_currentOrderInfo.projectNum    = this.labelContractNum.Text;
            m_currentOrderInfo.makeNum       = this.labelMakeNum.Text;
            m_currentOrderInfo.projectName   = this.labelDeviceName.Text;
            m_currentOrderInfo.note          = this.labelSummary.Text;
            m_currentOrderInfo.makeOrderDate = this.labelMakeDate.Text;

            m_currentOrderInfo.makeOrderStaffID = DbPublic.getInctance().getCurrentLoginUserID();

            if (m_billNumber.Length == 0)
            {
                m_currentOrderInfo.designStaffID = m_staffPkey;
            }
            else
            {
                m_currentOrderInfo.dataType = m_ProjectInfo.dataType;

                if (m_staffPkey != -1)
                {
                    m_currentOrderInfo.designStaffID = m_staffPkey;
                }
                else
                {
                    m_currentOrderInfo.designStaffID = m_ProjectInfo.designStaffID;
                }
            }
        }
Example #2
0
        private MaterielOutEarningsOrderTable getMaterielOutEarningsOrderValue()
        {
            MaterielOutEarningsOrderTable record = new MaterielOutEarningsOrderTable();

            record.tradingDate = this.labelTradingDate.Text;
            record.billNumber  = this.labelBillNumber.Text;

            record.sumValue = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Value].Value.ToString();
            record.sumMoney = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Turnover].Value.ToString();

            record.staffSaveId        = m_staffSavePkey;
            record.materielOutStaffId = m_materielOutStaffPkey;

            if (m_billNumber.Length == 0)
            {
                record.makeOrderStaff = DbPublic.getInctance().getCurrentLoginUserID();
            }
            else
            {
                record.makeOrderStaff = m_materieOutOrder.makeOrderStaff;
            }

            if (m_isRedBill)
            {
                record.isRedBill = 1;
            }
            else
            {
                record.isRedBill = 0;
            }

            return(record);
        }
        private void AutoGenerateMaterielPro(ArrayList purchaseOrderDetailsRecords)
        {
            // 形成物料表头信息
            MaterielProOccupiedOrderTable proOccupiedInfo = new MaterielProOccupiedOrderTable();

            proOccupiedInfo.tradingDate    = this.labelMakeDate.Text;
            proOccupiedInfo.billNumber     = this.labelBillNumber.Text;
            proOccupiedInfo.srcOrderNum    = this.labelBillNumber.Text;
            proOccupiedInfo.sumValue       = "0";
            proOccupiedInfo.sumMoney       = "0";
            proOccupiedInfo.applyStaffId   = DbPublic.getInctance().getCurrentLoginUserID();
            proOccupiedInfo.makeOrderStaff = DbPublic.getInctance().getCurrentLoginUserID();
            MaterielProOccupiedOrder.getInctance().insert(proOccupiedInfo, false);

            // 形成自动转库存详细信息
            ArrayList listDetails = new ArrayList();

            for (int i = 0; i < purchaseOrderDetailsRecords.Count; i++)
            {
                ProjectManagerDetailsTable recordPro = (ProjectManagerDetailsTable)purchaseOrderDetailsRecords[i];

                MaterielProOccupiedOrderDetailsTable record = new MaterielProOccupiedOrderDetailsTable();
                record.billNumber = this.labelBillNumber.Text;
                record.rowNumber  = Convert.ToString(recordPro.rowNumber);
                record.materielID = recordPro.materielID;
                record.price      = 0;
                record.value      = recordPro.value;
                record.note       = "";
                listDetails.Add(record);
            }
            MaterielProOccupiedOrderDetails.getInctance().insert(listDetails);
        }
Example #4
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 #5
0
        private void readProInfoListToUI()
        {
            for (int index = 0; index < m_proInfoList.Count; index++)
            {
                ArrayList record = new ArrayList();
                record = m_proInfoList[index];

                if (index == 0)
                {
                    this.labelTradingDate.Visible = true;
                    this.labelTradingDate.Text    = DateTime.Now.ToString("yyyy-MM-dd");

                    // 单据号
                    this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd"));

                    // 制单人初始化
                    this.labelMakeBillStaff.Visible = true;
                    this.labelMakeBillStaff.Text    = DbPublic.getInctance().getCurrentLoginUserName();

                    // 项目编号初始
                    this.textBoxProjectNo.Visible  = false;
                    this.textBoxProjectNo.ReadOnly = true;

                    this.labelProjectNo.Visible = true;
                    this.labelProjectNo.Text    = record[0].ToString();
                    this.labelProjectNo.Visible = true;

                    // 生产编号初始化
                    FormProjectMaterielTable proInfo = FormProject.getInctance().getProjectInfoFromBillNumber(record[0].ToString());
                    this.textBoxMakeNo.Visible = false;
                    //this.textBoxMakeNo.ReadOnly = true;

                    this.labelMakeNo.Visible = true;
                    this.labelMakeNo.Text    = proInfo.makeNum;
                    this.labelMakeNo.Visible = true;

                    m_materieOutOrder.isReview = "1";
                }

                setMatetielInfoToDataGridView(Convert.ToString(record[1]), index);
                dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.Value].Value = Convert.ToDouble(record[2]) - Convert.ToDouble(record[3]);


                string xxMatetielTableRowNum = Convert.ToString(record[7]);
                if (xxMatetielTableRowNum.Length > 0)
                {
                    ProjectManagerDetailsTable tmp = ProjectManagerDetails.getInctance().getMaterielInfoFromRowNum(record[0].ToString(), Convert.ToInt32(record[7]));
                    if (tmp.materielSize != null && tmp.materielSize.Length > 0)
                    {
                        dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.Note].Value = "尺寸:" + tmp.materielSize;
                    }
                }

                dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.xxMatetielTableRowNum].Value = Convert.ToString(record[7]);

                setTurnoverInfoDataGridView(index);
            }
        }
Example #6
0
        public FormOrderPrint(int orderType, string billNubmber, DataGridView dataGridView, DataGridView dataGridView2 = null)
        {
            InitializeComponent();
            m_excelIsOpen       = false;
            m_orderType         = orderType;
            m_billNubmber       = billNubmber;
            m_dataGridView      = dataGridView;
            m_dataGridViewOfter = dataGridView2;

            m_tempFilePath = Directory.GetCurrentDirectory() + "\\tdmb\\" + DbPublic.getInctance().getOrderNameFromType(orderType) + ".xlsx";
        }
Example #7
0
        private void panelCashInvoice_Click(object sender, EventArgs e)
        {
            /*函数实现逻辑
             * 1、检查系统中是否存在未审核的(采购入库(赊购),销售出库(赊购),付款单,收款单)
             * 2、得到当前系统记录的现金余额,更新cash_balance_last_month表
             * 3、得到当前系统记录的各银行存款余额,更新bank_balance_last_month表
             * 4、计算企业当前库存现金、银行存款、应收账款合计、应付账款合计、存货金额合计信息到企业利润表
             * 4、提示用户是否保存成功,如果保存失败,提示保存失败原因
             */
            if (DbPublic.getInctance().isCheckOut())
            {
                MessageBoxExtend.messageWarning("当前会计期间已经执行结转损益,不能重复执行!");
                return;
            }

            string msg = "建议执行结转损益操作放在每个会计期间的最后一天,结转损益执行完毕后,本会计期间无法再审核新单据。\n";

            msg += "请确认当前系统不存在未审核的以下单据:\n";
            msg += "1、采购入库(赊购)\n";
            msg += "2、销售出库(赊购)\n";
            msg += "3、付款单\n";
            msg += "4、收款单\n";
            msg += "确定执行结转吗?";
            if (MessageBoxExtend.messageQuestion(msg))
            {
                try
                {
                    // 现金余额结转
                    double cachBalance = BalanceManager.getCachBalance();
                    CashBalanceLastMonth.getInctance().insert(cachBalance, "结转余额");

                    // 银行存款余额结转
                    SortedDictionary <int, AuxiliaryMaterialDataTable> bankList
                        = AuxiliaryMaterial.getInctance().getAllAuxiliaryMaterialData("BASE_BANK_LIST");

                    foreach (KeyValuePair <int, AuxiliaryMaterialDataTable> index in bankList)
                    {
                        double bankBalance = BalanceManager.getBankBalance(index.Value.name);
                        BankBalanceLastMonth.getInctance().insert(index.Value.pkey, bankBalance, "结转余额");
                    }

                    // 企业利润信息
                    CompanyProfit.getInctance().insertCashInvoiceData();

                    OperatorLog.getInctance().insert(503, "执行结转损益.");
                }
                catch (Exception exp)
                {
                    MessageBoxExtend.messageWarning(exp.ToString());
                }
            }
        }
Example #8
0
        private void FormSaleQuotationOrder_Load(object sender, EventArgs e)
        {
            if (m_billNumber.Length == 0)
            {
                // 单据号
                this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd"));

                // 制单人初始化
                this.labelMakeBillStaff.Visible = true;
                this.labelMakeBillStaff.Text    = DbPublic.getInctance().getCurrentLoginUserName();
            }
            else
            {
                readBillInfoToUI();
            }
        }
Example #9
0
        public void delete()
        {
            string deleteSql = "DELETE FROM BASE_SYSTEM_CURRENT_LOGIN_USER WHERE USER_ID = ";

            deleteSql += DbPublic.getInctance().getCurrentLoginUserID();

            try
            {
                DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, deleteSql);
            }
            catch (Exception error)
            {
                MessageBoxExtend.messageWarning(error.Message);
                return;
            }
        }
Example #10
0
        public void insert(CashAccountReceivableDetailTable record, bool isUpdateInitAccountPayableTable = true)
        {
            string insert = "INSERT INTO [dbo].[CASH_ACCOUNT_PAYABLE_DETAIL]([SUPPLIER_ID]";

            insert += ",[BILL_TYPE_NAME],[BILL_NUMBER],[TURNOVER],[BALANCE],[STAFF_ID],[NOTE]) VALUES(";

            insert += record.customerOrSupplierID + ",";
            insert += "'" + record.billTypeName + "',";
            insert += "'" + record.billNumber + "',";
            insert += record.turnover + ",";

            if (isUpdateInitAccountPayableTable)
            {
                insert += getNewBalance(record) + ",";
            }
            else
            {
                insert += record.turnover + ",";
            }

            insert += DbPublic.getInctance().getCurrentLoginUserID() + ",";
            insert += "'" + record.note + "'";
            insert += ")";

            try
            {
                if (record.billTypeName == "期初数据")
                {
                    // 如果单据类型是期初数据,插入之前应该删除掉之前存在的该客户的期初欠款记录信息,有一个原则就是
                    // 一个客户的期初欠款记录在数据库中只有一条
                    string delete = "DELETE FROM CASH_ACCOUNT_PAYABLE_DETAIL WHERE BILL_TYPE_NAME = '期初数据' AND SUPPLIER_ID = ";
                    delete += record.customerOrSupplierID;

                    DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, delete);
                }

                DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, insert);

                load();
            }
            catch (Exception error)
            {
                MessageBoxExtend.messageWarning(error.Message);
                return;
            }
        }
Example #11
0
        private PurchaseInOrderTable getPurchaseInOrderValue()
        {
            PurchaseInOrderTable record = new PurchaseInOrderTable();

            record.supplierId       = m_supplierPkey;
            record.tradingDate      = this.labelTradingDate.Text;
            record.billNumber       = this.labelBillNumber.Text;
            record.purchaseType     = this.labelPurchaseType.Text;
            record.paymentDate      = this.labelPaymentDate.Text;
            record.exchangesUnit    = this.labelSummary.Text;
            record.sourceBillType   = this.labelSourceOrderType.Text;
            record.sourceBillNumber = this.labelSourceOrderNumber.Text;
            record.contractNum      = this.labelContractNum.Text;

            record.sumValue = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Value].Value.ToString();
            record.sumMoney = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Turnover].Value.ToString();

            record.sumTransportationCost = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.TransportationCost].Value.ToString();
            record.sumOtherCost          = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.OtherCost].Value.ToString();
            record.totalMoney            = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.SumTurnover].Value.ToString();

            record.staffSaveId  = m_staffSavePkey;
            record.staffCheckId = m_staffCheckPkey;

            record.businessPeopleId = m_staffPkey;

            if (m_billNumber.Length == 0)
            {
                record.makeOrderStaff = DbPublic.getInctance().getCurrentLoginUserID();
            }
            else
            {
                record.makeOrderStaff = m_purchaseInOrder.makeOrderStaff;
            }

            if (m_isRedBill)
            {
                record.isRedBill = 1;
            }
            else
            {
                record.isRedBill = 0;
            }

            return(record);
        }
Example #12
0
        private void readProInfoListToUI()
        {
            for (int index = 0; index < m_proInfoList.Count; index++)
            {
                ArrayList record = new ArrayList();

                record = m_proInfoList[index];

                if (index == 0)
                {
                    this.labelTradingDate.Visible = true;
                    this.labelTradingDate.Text    = DateTime.Now.ToString("yyyy-MM-dd");

                    // 单据号
                    this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd"));

                    // 制单人初始化
                    this.labelMakeBillStaff.Visible = true;
                    this.labelMakeBillStaff.Text    = DbPublic.getInctance().getCurrentLoginUserName();

                    this.panelDeliveryDate.Visible          = true;
                    this.labelDeliveryDate.Visible          = true;
                    this.dateTimePickerDeliveryDate.Visible = false;
                    this.labelDeliveryDate.Text             = this.dateTimePickerDeliveryDate.Value.ToString("yyyy-MM-dd");

                    // xx总材料表编号初始化
                    this.labelProject.Visible    = true;
                    this.labelProject.Text       = record[0].ToString();
                    this.panelProjectNum.Visible = false;
                    this.textBoxProject.Visible  = false;
                    this.textBoxProject.ReadOnly = true;

                    // 生产编号初始化
                    FormProjectMaterielTable proInfo = FormProject.getInctance().getProjectInfoFromBillNumber(record[0].ToString());
                    this.labelProject.Text += "(" + proInfo.makeNum + ")";

                    m_purchaseOrder.isReview = "1";
                }

                setMatetielInfoToDataGridView(Convert.ToString(record[1]), index);
                dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.Value].Value = Convert.ToDouble(record[2]) - Convert.ToDouble(record[3]);
                dataGridViewDataList.Rows[index].Cells[(int)DataGridColumnName.xxMatetielTableRowNum].Value = Convert.ToString(record[7]);
                setTurnoverInfoDataGridView(index);
            }
        }
Example #13
0
        public void registerInLedger(string billNumber, bool isRedBill)
        {
            /*函数处理逻辑如下:
             * 1、更新单据是否入账标示,把标示修改为1(已入账)
             * 1、如果采购方式为赊购并且发生了运输费用或其他费用,询问用户是否把运输费用或者其他费用计入应付账款
             * 2、根据采购单详细信息,更新库存表,如果发生了运输费用或其他费用,需要把运输费用和其他费用计入物料单价
             * 3、如果单据是根据采购订单生成,更新对应采购订单中的实际入库数量
             */

            m_isRedBill = isRedBill;

            // 更新库存表
            if (updateMaterielData(billNumber))
            {
                // 更新记账标示
                string update = "UPDATE [dbo].[SALE_OUT_ORDER] SET ";

                update += "[ORDERR_IN_LEDGER] = " + DbPublic.getInctance().getCurrentLoginUserID() + ",";
                update += "IN_LEDGER_DATE = '" + DateTime.Now.ToString("yyyyMMdd") + "', IS_IN_LEDGER = 1";
                update += " WHERE BILL_NUMBER = '" + billNumber + "'";

                try
                {
                    DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update);

                    MessageBoxExtend.messageOK("单据[" + billNumber + "]入账成功");

                    load();
                }
                catch (Exception error)
                {
                    MessageBoxExtend.messageWarning(error.Message);
                    return;
                }

                // 更新应收账款
                updateAccountReceivableData(billNumber);

                // 如果本张销售出库单是根据某销售订单生成,需要更新销售订单的实际入库数量字段
                updataActualValue(billNumber);
            }

            writeOperatorLog(203, OperatorLogType.Register, billNumber);
        }
Example #14
0
        private void updateAccountPayment()
        {
            try
            {
                CashAccountReceivableDetailTable record = new CashAccountReceivableDetailTable();

                record.customerOrSupplierID = getExchangesUnitID();
                record.billTypeName         = PAYMENT_ORDER_BILL_NAME;
                record.billNumber           = m_billNumber;
                record.tradingDate          = DateTime.Now.ToString("yyyyMMdd");
                record.turnover             = Convert.ToDouble(this.textBoxTransactionAmount.Text);
                record.staffID = DbPublic.getInctance().getCurrentLoginUserID();

                CashAccountPayableDetail.getInctance().insert(record);
            }
            catch (Exception)
            {
            }
        }
        private void FormMaterielProOccupied_Load(object sender, EventArgs e)
        {
            // DataGridView初始化
            dataGridViewInit();

            if (m_billNumber.Length == 0)
            {
                // 单据号
                this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd"));

                // 制单人初始化
                this.labelMakeBillStaff.Visible = true;
                this.labelMakeBillStaff.Text    = DbPublic.getInctance().getCurrentLoginUserName();
            }
            else
            {
                readBillInfoToUI();
            }
        }
Example #16
0
        private void buttonEnter_Click(object sender, EventArgs e)
        {
            if (AccessAuthorization.getInctance().passwordIsValidate(this.comboBoxUserName.Text.ToString(),
                                                                     this.textBoxPassword.Text.ToString(), out m_currentLoginUser))
            {
                m_loginSuccessful = true;
                DbPublic.getInctance().setCurrentLoginUserName(m_currentLoginUser.staffName);
                DbPublic.getInctance().setCurrentLoginUserID(m_currentLoginUser.pkey);

                // 更新BASE_SYSTEM_CURRENT_LOGIN_USER表
                CurrentLoginUser.getInctance().insert();
                this.Close();
            }
            else
            {
                MessageBoxExtend.messageWarning("密码错误,请重新输入!");
                this.textBoxPassword.Text = "";
                this.textBoxPassword.Focus();
            }
        }
Example #17
0
        private void setPageActionEnable()
        {
            SortedDictionary<int, ActionTable> list = MainProgram.model.Action.getInctance().getActionInfoFromModuleID(301);

            foreach (KeyValuePair<int, ActionTable> index in list)
            {
                object activeObject = this.GetType().GetField(index.Value.uiActionName,
                    System.Reflection.BindingFlags.NonPublic |
                    System.Reflection.BindingFlags.Instance |
                    System.Reflection.BindingFlags.IgnoreCase).GetValue(this);

                bool isEnable = AccessAuthorization.getInctance().isAccessAuthorization(index.Value.pkey,
                    Convert.ToString(DbPublic.getInctance().getCurrentLoginUserID()));

                if (activeObject != null)
                {
                    UserInterfaceActonState.setUserInterfaceActonState(activeObject,
                        ((System.Reflection.MemberInfo)(activeObject.GetType())).Name.ToString(), isEnable);
                }
            }
        }
Example #18
0
        private void FormMain_Load(object sender, EventArgs e)
        {
            //检测系统是否已经注册为正版
            if (!DbPublic.getInctance().isGenuineSoftware())
            {
                this.Text = this.Text + "(试用版)";
            }
            else
            {
                // 如果已注册为正版,检测当初注册时硬盘序列号和本次启动机器硬盘序列号是否相同,如果相同则视为正常,否则视同一序列号多人使用
                if (DbPublic.getInctance().getRegisterSoftwareKey() != SettlmentWay.getInctance().getSoftwareKey())
                {
                    MessageBoxExtend.messageWarning("同一软件序列号涉嫌多单位使用,程序将立即退出。\n如需继续使用该系统,请联系软件供应商。");
                    CurrentLoginUser.getInctance().delete();
                    Process.GetCurrentProcess().Kill();
                }
            }

            // 当系统未被初始化时,单据菜单、序时簿菜单不能显示
            this.menuBill.Visible = InitSubSystemSign.getInctance().isFinancialSystemInit() &&
                                    InitSubSystemSign.getInctance().isBusinessSystemInit();
            this.menuSquence.Visible = InitSubSystemSign.getInctance().isFinancialSystemInit() &&
                                       InitSubSystemSign.getInctance().isBusinessSystemInit();

            // 左侧功能按钮初始化
            LoadFunctionZone();
            this.WindowState = FormWindowState.Maximized;

            // 更新状态栏信息
            string statusBarText = DbPublic.getInctance().getCurrentDateStage();

            statusBarText += "                              ";
            statusBarText += "用户:" + DbPublic.getInctance().getCurrentLoginUserName();
            this.toolStripStatusLabel.Text = statusBarText;

            // 2017-5-10 开启一个新的线程,完成数据库备份
            Thread databaseBackTread = new Thread(new ThreadStart(ThreadFuction));

            databaseBackTread.Start();
        }
        private void geTableHadeAndEndValue()
        {
            m_currentOrderInfo.projectNum = m_projectNum;
            m_currentOrderInfo.srcBillNumber = this.labelSrcOrderBillNum.Text;

            if (m_billNumber.Length == 0)
            {
                m_currentOrderInfo.designStaffID = m_staffPkey;
            }
            else
            {
                m_currentOrderInfo.designStaffID = m_currentOrderInfo.designStaffID;
            }

            m_currentOrderInfo.billNumber = this.labelBillNumber.Text;
            m_currentOrderInfo.changeReason = this.labelSummary.Text;


            m_currentOrderInfo.makeOrderDate = this.labelMakeDate.Text;
            m_currentOrderInfo.makeOrderStaffID = DbPublic.getInctance().getCurrentLoginUserID();

            m_currentOrderInfo.materielIDs = "";
            for (int rowIndex = 0; rowIndex < dataGridViewDataListChangeOfter.Rows.Count; rowIndex++)
            {
                if (this.dataGridViewDataListChangeOfter.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value.ToString().Length == 0)
                {
                    break;
                }
                else
                {
                    m_currentOrderInfo.materielIDs += dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.MatetielNumber].Value.ToString();
                    m_currentOrderInfo.materielIDs += ",";
                    m_currentOrderInfo.materielIDs += dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Num].Value.ToString();
                    m_currentOrderInfo.materielIDs += ",";
                    m_currentOrderInfo.materielIDs += dataGridViewDataListChange.Rows[rowIndex].Cells[(int)DataGridColumnName.Sequence].Value.ToString();
                    m_currentOrderInfo.materielIDs += "#";
                }
            }
        }
Example #20
0
        private void FormSaleOutOrder_Load(object sender, EventArgs e)
        {
            // DataGridView初始化
            dataGridViewInit();

            // 销售方式初始化
            this.labelSaleType.Visible = true;
            this.comboBoxSaleType.Items.Add("现购");
            this.comboBoxSaleType.Items.Add("赊购");
            this.comboBoxSaleType.SelectedIndex = 0;


            // 源单类型初始化
            this.labelSourceOrderType.Visible = true;
            this.comboBoxSourceOrderType.Items.Add("销售订单");
            this.comboBoxSourceOrderType.Items.Add("销售发票");
            this.comboBoxSourceOrderType.SelectedIndex = 0;

            if (m_billNumber.Length == 0)
            {
                // 单据号
                this.labelBillNumber.Text = BillNumber.getInctance().getNewBillNumber(BillTypeNumber, DateTime.Now.ToString("yyyy-MM-dd"));

                // 销售方式默认值
                this.labelSaleType.Text = this.comboBoxSaleType.Text;

                // 制单人初始化
                this.labelMakeBillStaff.Visible = true;
                this.labelMakeBillStaff.Text    = DbPublic.getInctance().getCurrentLoginUserName();
            }
            else
            {
                readBillInfoToUI();
            }

            setPageActionEnable();
        }
Example #21
0
        public void billReview(string billNumber)
        {
            string update = "UPDATE [dbo].[PURCHASE_ORDER] SET ";

            update += "[ORDERR_REVIEW] = " + DbPublic.getInctance().getCurrentLoginUserID() + ",";
            update += "REVIEW_DATE = '" + DateTime.Now.ToString("yyyyMMdd") + "', IS_REVIEW = 1";
            update += " WHERE BILL_NUMBER = '" + billNumber + "'";

            try
            {
                DatabaseAccessFactoryInstance.Instance.ExecuteCommand(FormMain.DB_NAME, update);

                MessageBoxExtend.messageOK("单据[" + billNumber + "]审核成功");

                load();
            }
            catch (Exception error)
            {
                MessageBoxExtend.messageWarning(error.Message);
                return;
            }

            writeOperatorLog(101, OperatorLogType.Review, billNumber);
        }
        private MaterielProOccupiedOrderTable getMaterielProOccupiedOrderValue()
        {
            MaterielProOccupiedOrderTable record = new MaterielProOccupiedOrderTable();

            record.tradingDate   = this.labelTradingDate.Text;
            record.billNumber    = this.labelBillNumber.Text;
            record.exchangesUnit = this.labelSummary.Text;

            record.sumValue = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Value].Value.ToString();
            record.sumMoney = this.dataGridViewDataCount.Rows[0].Cells[(int)DataGridColumnName.Turnover].Value.ToString();

            record.applyStaffId = m_applyStaffPkey;

            if (m_billNumber.Length == 0)
            {
                record.makeOrderStaff = DbPublic.getInctance().getCurrentLoginUserID();
            }
            else
            {
                record.makeOrderStaff = m_materieOutOrder.makeOrderStaff;
            }

            return(record);
        }
Example #23
0
 private void setPageActionEnable()
 {
     this.panelDBBackConfig.Enabled = AccessAuthorization.getInctance().isAccessAuthorization(111,
                                                                                              Convert.ToString(DbPublic.getInctance().getCurrentLoginUserID()));
 }
Example #24
0
        private void buttonSend_Click(object sender, EventArgs e)
        {
            if (textBoxTel.Text.Length == 0)
            {
                MessageBoxExtend.messageWarning("联系电话不能为空");
                return;
            }

            // 6MY5O-8R6G2-F08WF-YDABG-QCWCH
            string keyGroup1 = this.textBoxKey1.Text;
            string keyGroup2 = this.textBoxKey2.Text;
            string keyGroup3 = this.textBoxKey3.Text;
            string keyGroup4 = this.textBoxKey4.Text;
            string keyGroup5 = this.textBoxKey5.Text;

            /* 注册函数逻辑
             * 1、判断是否系统已经被注册为正版软件
             *      如果是,提示用户无需要重复注册。
             *      如果不是,进行步骤2
             * 2、验证序列号格式:判断下每组序列号长度是否为5
             *      如果不是,则说明序列号格式错误
             *      如果是,则进行步骤3
             * 3、验证序列号是否是正版序列号
             *      如果不是,则提示用户 序列号错误,请联系软件供应商,索取正版序列号。
             *      如果是,则进行步骤4
             * 4、查询邮件服务器,看是否次序列号已经被其他单位或企业注册过
             *      如果已被注册过,说明客户拿到的序列号不是软件供应商提供的全新序列号,是从其他单位借的,或其他
             *      如果没有注册过,说明次序列号为全新序列号,执行步骤5
             * 5、把序列号信息保存到数据库,分别保存到INIT_SUB_SYSTEM_SIGN表和BASE_SETTLMENT_WAY表,确保不太容易被破解
             * 6、发送邮件:邮件标题为:序列号。正为是序列号 + 当前注册日期
             * */

            if (keyGroup1.Length != 5 || keyGroup2.Length != 5 || keyGroup3.Length != 5 || keyGroup4.Length != 5 || keyGroup5.Length != 5)
            {
                MessageBoxExtend.messageWarning("序列号错误,请联系软件供应商,索取正版序列号。");
            }
            else
            {
                if (DbPublic.getInctance().isGenuineSoftware())
                {
                    MessageBoxExtend.messageWarning("软件已注册为正版,不需要重复注册");
                }
                else
                {
                    TivLog.Logger.Info("开始验证是否是正版序列号...");
                    if (serialNumberManager.checkKey(keyGroup1, keyGroup2, 5) &&
                        serialNumberManager.checkKey(keyGroup2, keyGroup3, 10) &&
                        serialNumberManager.checkKey(keyGroup3, keyGroup4, 15) &&
                        serialNumberManager.checkKey(keyGroup4, keyGroup5, 20))
                    {
                        TivLog.Logger.Info("序列号验证通过,开始查找是否已经被注册过");
                        try
                        {
                            string serialNumber = keyGroup1 + keyGroup2 + keyGroup3 + keyGroup4 + keyGroup5;
                            if (serialNumberManager.serialNumberIsExist(serialNumber))
                            {
                                MessageBoxExtend.messageWarning("注册失败!此序列号已被使用,请联系软件供应商,重新索取序列号。");
                            }
                            else
                            {
                                TivLog.Logger.Info("序列号验未被使用,开始注册工作...");
                                serialNumberManager.sendSerialNumberEmail(serialNumber, serialNumber + this.textBoxTel.Text);
                                TivLog.Logger.Info("邮件发送成功,开始写数据库");

                                // 插入到INIT_SUB_SYSTEM_SIGN
                                InitSubSystemSign.getInctance().register(serialNumber);

                                // 插入到BASE_SETTLMENT_WAY
                                SettlmentWayTable record = new SettlmentWayTable();
                                record.name      = serialNumber;
                                record.subjectID = "#####";
                                SettlmentWay.getInctance().insert(record, false);

                                TivLog.Logger.Info("数据库更新成功,序列号注册成功");
                                MessageBoxExtend.messageOK("感谢您注册并激活产品");
                            }
                        }
                        catch (Exception exp)
                        {
                            TivLog.Logger.Error(exp.ToString());
                            MessageBoxExtend.messageWarning("注册失败!可能因为网络未联通或网络堵塞等原因造成,请稍后重新");
                        }
                    }
                    else
                    {
                        MessageBoxExtend.messageError("序列号错误,请联系软件供应商,索取正版序列号。");
                    }
                }

                this.Close();
            }
        }
        public FormStorageStockDetails()
        {
            InitializeComponent();

            // 默认查询得本月第一天开始到本月最后一天的数据
            DateTime nowDate = DateTime.Now;
            DateTime currentMonthFirstDay = new DateTime(nowDate.Year, nowDate.Month, 1);
            DateTime currentMonthLastDay  = currentMonthFirstDay.AddMonths(1).AddDays(-1);

            m_countStartDate = currentMonthFirstDay.ToString("yyyyMMdd");
            m_countEndDate   = currentMonthLastDay.ToString("yyyyMMdd");

            m_materielList = Materiel.getInctance().getAllMaterielInfo();

            if (m_materielList.Count > 0)
            {
                m_currentRecordIndex = 0;
            }

            // 判断下是否有查看单价的权限
            SortedDictionary <int, ActionTable> list = MainProgram.model.Action.getInctance().getActionInfoFromModuleID(m_moduleID);

            foreach (KeyValuePair <int, ActionTable> index in list)
            {
                if (index.Value.uiActionName == "dispaly")
                {
                    m_isDisplayJG = AccessAuthorization.getInctance().isAccessAuthorization(index.Value.pkey,
                                                                                            Convert.ToString(DbPublic.getInctance().getCurrentLoginUserID()));
                }
            }
        }
Example #26
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 #27
0
        private void buttonSave_Click(object sender, EventArgs e)
        {
            if (this.textBoxFileDirectory.Text.Length == 0)
            {
                MessageBoxExtend.messageWarning(this.labelPath.Text + "不能为空,请填写");
                return;
            }

            if (this.textBoxReason.Text.Length == 0)
            {
                MessageBoxExtend.messageWarning(this.labelReason.Text + "不能为空,请填写");
                return;
            }

            if (m_isBackup)
            {
                DbBackupRecordTable record = new DbBackupRecordTable();

                record.name      = DbPublic.getInctance().getCurrentLoginUserName();
                record.hostName  = Dns.GetHostName();
                record.backType  = 0;
                record.reason    = this.textBoxReason.Text;
                record.note      = this.textBoxNode.Text;
                record.savePath1 = this.textBoxFileDirectory.Text;

                //DbBackupRecord.getInctance().insert(record);

                //string parameter = record.savePath1 + " #";

                //// 启动DBBackup.exe
                //Process.Start(@"DBBackup.exe", parameter);

                if (DbBackupRecord.getInctance().databaseBack(record.savePath1))
                {
                    DbBackupRecord.getInctance().insert(record);
                }
            }
            else
            {
                DbRollbackRecordTable record = new DbRollbackRecordTable();

                record.name     = DbPublic.getInctance().getCurrentLoginUserName();
                record.hostName = Dns.GetHostName();
                record.reason   = this.textBoxReason.Text;
                record.note     = this.textBoxNode.Text;
                record.fileName = this.textBoxFileDirectory.Text;

                record.reason = this.textBoxReason.Text;
                record.note   = this.textBoxNode.Text;

                //DbRollbackRecord.getInctance().insert(record);
                //string newRecordID = Convert.ToString(DbPublic.getInctance().getTableMaxPkey("BASE_DB_ROLLBACK_RECORD") + 1);
                //string parameter = record.fileName + " " + newRecordID;

                //// 启动DBBackup.exe
                //Process.Start(@"DBRollback.exe", parameter);

                if (DbRollbackRecord.getInctance().databaseRollback(record.fileName))
                {
                    DbRollbackRecord.getInctance().insert(record);
                }
            }

            this.Close();
        }
Example #28
0
        // 参数isDisplayJG代表实现显示单价列
        public FormMaterielStorageAmountInfo(int displayDataType = -1, bool isDisplayJG = true)
        {
            InitializeComponent();

            if (displayDataType != -1)
            {
                m_displayDataType = displayDataType;
            }
            else
            {
                m_displayDataType = (int)DisplayDataType.All;
            }

            if (isDisplayJG)
            {
                // 判断下是否有查看单价的权限
                SortedDictionary <int, ActionTable> list = MainProgram.model.Action.getInctance().getActionInfoFromModuleID(105);

                foreach (KeyValuePair <int, ActionTable> index in list)
                {
                    if (index.Value.uiActionName == "dispaly")
                    {
                        m_isDisplayJG = AccessAuthorization.getInctance().isAccessAuthorization(index.Value.pkey,
                                                                                                Convert.ToString(DbPublic.getInctance().getCurrentLoginUserID()));
                    }
                }
            }

            if (m_displayDataType == (int)DisplayDataType.Materiel)
            {
                this.Text = "当前库存信息(物料)";
            }
            else if (m_displayDataType == (int)DisplayDataType.Product)
            {
                this.Text = "当前库存信息(商品)";
            }
            else
            {
                this.Text = "当前库存信息";
            }
        }
Example #29
0
 public int getRecordCount()
 {
     return(DbPublic.getInctance().tableRecordCount("SELECT COUNT(*) FROM BASE_DB_BACKUP_CONFIG"));
 }