示例#1
0
        /// <summary>
        /// 验证应收应付单据本次结算是否大于结算金额
        /// </summary>
        /// <param name="orderType">单据类型</param>
        /// <param name="id">单据ID</param>
        /// <returns></returns>
        public static bool CheckDocumentMoney(DataSources.EnumOrderType orderType, string id)
        {
            SQLObj sqlSettlement = new SQLObj();

            sqlSettlement.cmdType = CommandType.Text;
            sqlSettlement.Param   = new Dictionary <string, ParamObj>();
            sqlSettlement.Param.Add("order_id", new ParamObj("order_id", id, SysDbType.VarChar, 40));
            if (orderType == DataSources.EnumOrderType.RECEIVABLE)
            {
                sqlSettlement.sqlString = @"select a.order_id,a.settlement_money from tb_balance_documents a 
left join v_YingShou c on a.documents_id=c.documents_id  
where (a.billing_money- isnull(c.money,0))<a.settlement_money and a.order_id=@order_id";
            }
            else
            {
                sqlSettlement.sqlString = @"select a.order_id,a.settlement_money from tb_balance_documents a 
left join v_YingFu c on a.documents_id=c.documents_id  
where (a.billing_money- isnull(c.money,0))<a.settlement_money and a.order_id=@order_id";
            }
            DataSet ds = DBHelper.GetDataSet("验证应收应付单据", sqlSettlement);

            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
示例#2
0
        void OpenDocument()
        {
            if (dgvReport.CurrentRow == null)
            {
                return;
            }
            //单据ID
            string orderId = Convert.ToString(this.dgvReport.CurrentRow.Cells[colID.Name].Value);

            if (orderId.Length == 0)
            {
                return;
            }
            //单据类型
            string orderType = CommonCtrl.IsNullToString(dgvReport.CurrentRow.Cells[colOrderType.Name].Value);

            if (orderType.Length == 0)
            {
                return;
            }
            string viewTitle = "应收账款-查看";//明细标题

            DataSources.EnumOrderType enumOrderType = (DataSources.EnumOrderType)Convert.ToInt32(orderType);
            if (enumOrderType == DataSources.EnumOrderType.PAYMENT)
            {
                viewTitle = "应付账款-查看";
            }
            UCReceivableAdd ucView = new UCReceivableAdd(WindowStatus.View, orderId, null, enumOrderType);

            base.addUserControl(ucView, viewTitle, "UCReceivableAdd" + orderId, this.Tag.ToString(), this.Name);
        }
示例#3
0
        /// <summary>
        /// 获取预收/付余额
        /// </summary>
        /// <param name="custID">往来单位单位ID</param>
        /// <param name="orderType">单据类型</param>
        /// <returns></returns>
        public static decimal GetAdvance(string custID, DataSources.EnumOrderType orderType)
        {
            SYSModel.SQLObj sql = new SYSModel.SQLObj();
            sql.cmdType = CommandType.StoredProcedure;
            if (orderType == DataSources.EnumOrderType.PAYMENT)
            {
                sql.sqlString = "p_yufu_yu_e";
            }
            else
            {
                sql.sqlString = "p_yushou_yu_e";
            }
            sql.Param = new Dictionary <string, ParamObj>();
            sql.Param.Add("cust_id", new ParamObj("cust_id", custID, SysDbType.VarChar, 40));
            DataSet ds = DBHelper.GetDataSet("查询往来余额", sql);

            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0 || ds.Tables[0].Rows[0][0] == DBNull.Value)
            {
                return(0);
            }
            else
            {
                return(Convert.ToDecimal(ds.Tables[0].Rows[0][0]));
            }
        }
示例#4
0
 bool isAutoClose = false;//是否自动关闭
 #endregion
 public UCReceivableAdd(WindowStatus status, string orderId, UCReceivableManage uc, DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     this.dgvBalanceDocuments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                 | System.Windows.Forms.AnchorStyles.Right | AnchorStyles.Bottom)));
     this.windowStatus = status;
     this.orderID = orderId;
     this.uc = uc;
     this.orderType = orderType;
     this.orderTypeName = DataSources.GetDescription(orderType, true);
     colBillingMoney.ValueType = typeof(decimal);
     colSettledMoney.ValueType = typeof(decimal);
     colSettlementMoney.ValueType = typeof(decimal);
     colWaitSettledMoney.ValueType = typeof(decimal);
     colPaidMoney.ValueType = typeof(decimal);
     //colDepositRate.ValueType = typeof(decimal);
     //colDeduction.ValueType = typeof(decimal);
     colMoney.ValueType = typeof(decimal);
     dgvBalanceDocuments.RowHeadersVisible = true;
     dgvPaymentDetail.RowHeadersVisible = true;
     base.SaveEvent += new ClickHandler(UCReceivableAdd_SaveEvent);
     base.ImportEvent += new ClickHandler(UCReceivableAdd_ImportEvent);
     base.SubmitEvent += new ClickHandler(UCReceivableAdd_SubmitEvent);
     base.CancelEvent += new ClickHandler(UCReceivableAdd_CancelEvent);
     base.VerifyEvent += new ClickHandler(UCReceivableAdd_VerifyEvent);
     base.InvalidOrActivationEvent += new ClickHandler(UCReceivableAdd_InvalidOrActivationEvent);
     base.CopyEvent += new ClickHandler(UCReceivableAdd_CopyEvent);
     base.EditEvent += new ClickHandler(UCReceivableAdd_EditEvent);
     base.DeleteEvent += new ClickHandler(UCReceivableAdd_DeleteEvent);
     DataGridViewEx.SetDataGridViewStyle(dgvPaymentDetail, colRemark);
     DataGridViewEx.SetDataGridViewStyle(dgvBalanceDocuments, colDocumentRemark);
 }
示例#5
0
 BusinessPrint businessPrint; //业务打印功能
 #endregion
 public UCReceivableManage(DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     //工具栏事件
     this.AddEvent    += new ClickHandler(UCReceivableManage_AddEvent);
     this.EditEvent   += new ClickHandler(UCReceivableManage_EditEvent);
     this.CopyEvent   += new ClickHandler(UCReceivableManage_CopyEvent);
     this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent);
     this.ViewEvent   += new ClickHandler(UCReceivableManage_ViewEvent);
     this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent);
     this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent);
     this.PrintEvent  += new ClickHandler(UCReceivableManage_PrintEvent);
     this.ExportEvent += new ClickHandler(UCReceivableManage_ExportEvent);
     base.SetEvent    += new ClickHandler(UCReceivableManage_SetEvent);
     this.orderType    = orderType;//单据类型
     DataGridViewEx.SetDataGridViewStyle(dgvBillReceivable, colOrderStatus);
     dgvBillReceivable.ReadOnly          = false;
     dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged);
     foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns)
     {
         if (dgvc.Name == colCheck.Name)
         {
             continue;
         }
         dgvc.ReadOnly = true;
     }
     SetLable();
     #region 打印预览
     string printObject = "tb_receivable";
     string printTitle  = "财务收款单";
     if (orderType == DataSources.EnumOrderType.PAYMENT)
     {
         printObject = "tb_payment";
         printTitle  = "财务付款单";
     }
     List <string> listNotPrint = new List <string>();
     listNotPrint.Add(colOrgId.Name);
     listNotPrint.Add(colHandle.Name);
     PaperSize paperSize = new PaperSize();
     paperSize.Width  = 297;
     paperSize.Height = 210;
     businessPrint    = new BusinessPrint(dgvBillReceivable, printObject, printTitle, paperSize, listNotPrint);
     #endregion
     //速查
     SetQuick();
     colDealingsBalance.ValueType = typeof(decimal);
     //负数格式化红色
     ControlsConfig.NegativeFormatting(dgvBillReceivable);
 }
示例#6
0
        /// <summary>
        /// 计算应收应付单据已预收付金额
        /// </summary>
        /// <param name="orderType">应收应付单据类型</param>
        /// <param name="id">应收应付ID</param>
        /// <param name="list">sql列表</param>
        public static void DocumentAdvanceByBill(DataSources.EnumOrderType orderType, string id, List <SysSQLString> list)
        {
            SysSQLString sqlSettlement = new SysSQLString();

            sqlSettlement.cmdType = CommandType.StoredProcedure;
            sqlSettlement.Param   = new Dictionary <string, string>();
            sqlSettlement.Param.Add("order_id", id);
            if (orderType == DataSources.EnumOrderType.RECEIVABLE)
            {
                sqlSettlement.sqlString = "p_yushou_jiesuan";
            }
            else
            {
                sqlSettlement.sqlString = "p_yufu_jiesuan";
            }
            list.Add(sqlSettlement);
        }
示例#7
0
 public UCReceivableAdd(WindowStatus status, string orderId, UCReceivableManage uc, DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     this.dgvBalanceDocuments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                 | System.Windows.Forms.AnchorStyles.Right | AnchorStyles.Bottom)));
     this.windowStatus = status;
     this.orderID = orderId;//单据ID
     this.uc = uc;//默认页面
     this.orderType = orderType;//单据类型
     this.orderTypeName = DataSources.GetDescription(orderType, true);
     //设置单元格类型
     colBillingMoney.ValueType = typeof(decimal);
     colSettledMoney.ValueType = typeof(decimal);
     colSettlementMoney.ValueType = typeof(decimal);
     colWaitSettledMoney.ValueType = typeof(decimal);
     colPaidMoney.ValueType = typeof(decimal);
     //colDepositRate.ValueType = typeof(decimal);
     //colDeduction.ValueType = typeof(decimal);
     colMoney.ValueType = typeof(decimal);
     dgvBalanceDocuments.RowHeadersVisible = true;
     dgvPaymentDetail.RowHeadersVisible = true;
     //工具栏事件
     base.SaveEvent += new ClickHandler(UCReceivableAdd_SaveEvent);
     base.ImportEvent += new ClickHandler(UCReceivableAdd_ImportEvent);
     base.SubmitEvent += new ClickHandler(UCReceivableAdd_SubmitEvent);
     base.CancelEvent += new ClickHandler(UCReceivableAdd_CancelEvent);
     base.VerifyEvent += new ClickHandler(UCReceivableAdd_VerifyEvent);
     base.InvalidOrActivationEvent += new ClickHandler(UCReceivableAdd_InvalidOrActivationEvent);
     base.CopyEvent += new ClickHandler(UCReceivableAdd_CopyEvent);
     base.EditEvent += new ClickHandler(UCReceivableAdd_EditEvent);
     base.DeleteEvent += new ClickHandler(UCReceivableAdd_DeleteEvent);
     base.ViewEvent += new ClickHandler(UCReceivableAdd_ViewEvent);
     base.PrintEvent += new ClickHandler(UCReceivableAdd_PrintEvent);
     base.SetEvent += new ClickHandler(UCReceivableAdd_SetEvent);
     //
     DataGridViewEx.SetDataGridViewStyle(dgvPaymentDetail, colRemark);
     DataGridViewEx.SetDataGridViewStyle(dgvBalanceDocuments, colDocumentRemark);
     txtBankAccount.InnerTextBox.TextChanged += new EventHandler(txtBankAccount_ValueChanged);
     //打印预览
     detailPrint = new BusinessDetailPrint(Title);
     //快速设置
     SetQuick();
     //负数格式化红色
     ControlsConfig.NegativeFormatting(dgvBalanceDocuments);
     ControlsConfig.NegativeFormatting(dgvPaymentDetail);
 }
示例#8
0
        /// <summary>
        /// 重新计算单据的已结算,待结算金额
        /// </summary>
        /// <param name="orderType">单据类型</param>
        /// <param name="id">单据ID</param>
        /// <param name="list"></param>
        public static void DocumentMoney(DataSources.EnumOrderType orderType, string id, List <SysSQLString> list)
        {
            SysSQLString sqlSettlement = new SysSQLString();

            sqlSettlement.cmdType = CommandType.Text;
            sqlSettlement.Param   = new Dictionary <string, string>();
            sqlSettlement.Param.Add("order_id", id);
            if (orderType == DataSources.EnumOrderType.RECEIVABLE)
            {
                sqlSettlement.sqlString = @"update a set settled_money=b.money,wait_settled_money=billing_money-ISNULL(b.money,0) 
from tb_balance_documents a left join v_YingShou b on a.documents_id=b.documents_id where a.order_id=@order_id";
            }
            else
            {
                sqlSettlement.sqlString = @"update a set settled_money=b.money,wait_settled_money=billing_money-ISNULL(b.money,0) 
from tb_balance_documents a left join v_YingFu b on a.documents_id=b.documents_id where a.order_id=@order_id";
            }
            list.Add(sqlSettlement);
        }
示例#9
0
        BusinessPrint businessPrint; //业务打印功能
        #endregion
        public UCReceivableManage(DataSources.EnumOrderType orderType)
        {
            InitializeComponent();
            this.AddEvent    += new ClickHandler(UCReceivableManage_AddEvent);
            this.EditEvent   += new ClickHandler(UCReceivableManage_EditEvent);
            this.CopyEvent   += new ClickHandler(UCReceivableManage_CopyEvent);
            this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent);
            this.ViewEvent   += new ClickHandler(UCReceivableManage_ViewEvent);
            this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent);
            this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent);
            this.PrintEvent  += new ClickHandler(UCReceivableManage_PrintEvent);
            this.ExportEvent += new ClickHandler(UCReceivableManage_ExportEvent);
            this.orderType    = orderType;
            DataGridViewEx.SetDataGridViewStyle(dgvBillReceivable, colOrderStatus);
            dgvBillReceivable.ReadOnly          = false;
            dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged);
            foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns)
            {
                if (dgvc.Name == colCheck.Name)
                {
                    continue;
                }
                dgvc.ReadOnly = true;
            }
            SetLable();
            string printObject = "tb_receivable";
            string printTitle  = "应收账款";

            if (orderType == DataSources.EnumOrderType.PAYMENT)
            {
                printObject = "tb_payment";
                printTitle  = "应付账款";
            }
            List <string> listNotPrint = new List <string>();

            listNotPrint.Add(colOrgId.Name);
            listNotPrint.Add(colHandle.Name);
            PaperSize paperSize = new PaperSize();

            paperSize.Width  = 297;
            paperSize.Height = 210;
            businessPrint    = new BusinessPrint(dgvBillReceivable, printObject, printTitle, paperSize, listNotPrint);
        }
 public UCReceivableManage(DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     this.AddEvent += new ClickHandler(UCReceivableManage_AddEvent);
     this.EditEvent += new ClickHandler(UCReceivableManage_EditEvent);
     this.CopyEvent += new ClickHandler(UCReceivableManage_CopyEvent);
     this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent);
     this.ViewEvent += new ClickHandler(UCReceivableManage_ViewEvent);
     this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent);
     this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent);
     this.orderType = orderType;
     dgvBillReceivable.ReadOnly = false;
     dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged);
     foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns)
     {
         if (dgvc.Name == colCheck.Name)
         {
             continue;
         }
         dgvc.ReadOnly = true;
     }
 }
示例#11
0
 public UCReceivableManage(DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     this.AddEvent                      += new ClickHandler(UCReceivableManage_AddEvent);
     this.EditEvent                     += new ClickHandler(UCReceivableManage_EditEvent);
     this.CopyEvent                     += new ClickHandler(UCReceivableManage_CopyEvent);
     this.DeleteEvent                   += new ClickHandler(UCReceivableManage_DeleteEvent);
     this.ViewEvent                     += new ClickHandler(UCReceivableManage_ViewEvent);
     this.VerifyEvent                   += new ClickHandler(UCReceivableManage_VerifyEvent);
     this.SubmitEvent                   += new ClickHandler(UCReceivableManage_SubmitEvent);
     this.orderType                      = orderType;
     dgvBillReceivable.ReadOnly          = false;
     dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged);
     foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns)
     {
         if (dgvc.Name == colCheck.Name)
         {
             continue;
         }
         dgvc.ReadOnly = true;
     }
 }
 BusinessPrint businessPrint;//业务打印功能
 #endregion
 public UCReceivableManage(DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     this.AddEvent += new ClickHandler(UCReceivableManage_AddEvent);
     this.EditEvent += new ClickHandler(UCReceivableManage_EditEvent);
     this.CopyEvent += new ClickHandler(UCReceivableManage_CopyEvent);
     this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent);
     this.ViewEvent += new ClickHandler(UCReceivableManage_ViewEvent);
     this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent);
     this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent);
     this.PrintEvent += new ClickHandler(UCReceivableManage_PrintEvent);
     this.ExportEvent += new ClickHandler(UCReceivableManage_ExportEvent);
     this.orderType = orderType;
     DataGridViewEx.SetDataGridViewStyle(dgvBillReceivable, colOrderStatus);
     dgvBillReceivable.ReadOnly = false;
     dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged);
     foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns)
     {
         if (dgvc.Name == colCheck.Name)
         {
             continue;
         }
         dgvc.ReadOnly = true;
     }
     SetLable();
     string printObject = "tb_receivable";
     string printTitle = "财务收款单";
     if (orderType == DataSources.EnumOrderType.PAYMENT)
     {
         printObject = "tb_payment";
         printTitle = "财务付款单";
     }
     List<string> listNotPrint = new List<string>();
     listNotPrint.Add(colOrgId.Name);
     listNotPrint.Add(colHandle.Name);
     PaperSize paperSize = new PaperSize();
     paperSize.Width = 297;
     paperSize.Height = 210;
     businessPrint = new BusinessPrint(dgvBillReceivable, printObject, printTitle, paperSize, listNotPrint);
 }
示例#13
0
        //审核
        void VerifyData()
        {
            string files = string.Empty;

            foreach (DataGridViewRow dgvr in dgvBillReceivable.Rows)
            {
                if (Convert.ToBoolean(dgvr.Cells[colCheck.Name].EditedFormattedValue))
                {
                    files += string.Format("'{0}',", dgvr.Cells[colPayableSingleID.Name].Value);
                }
            }
            if (files.Length == 0)
            {
                MessageBoxEx.Show("请选择要审核的数据!");
                return;
            }
            UCVerify frmVerify = new UCVerify();

            if (frmVerify.ShowDialog() == DialogResult.OK)
            {
                files = files.TrimEnd(',');
                SysSQLString sql = new SysSQLString();
                sql.cmdType   = CommandType.Text;
                sql.sqlString = string.Format("update tb_bill_receivable set order_status='{0}',Verify_advice='{1}' where payable_single_id in ({2}) and order_status='{3}';",
                                              (int)frmVerify.auditStatus, frmVerify.Content, files, (int)DataSources.EnumAuditStatus.SUBMIT);
                sql.Param = new Dictionary <string, string>();
                List <SysSQLString> listSql = new List <SysSQLString>();
                listSql.Add(sql);
                //如果是审核不通过,则将没有提交或审核状态的单据设为正常
                if (frmVerify.auditStatus == DataSources.EnumAuditStatus.NOTAUDIT)
                {
                    if (orderType == DataSources.EnumOrderType.RECEIVABLE)
                    {
                        SysSQLString receivableSql = new SysSQLString();
                        receivableSql.cmdType   = CommandType.Text;
                        receivableSql.sqlString = string.Format(@"update tb_parts_sale_billing set is_occupy=@is_occupy where where sale_billing_id in (select documents_id from tb_balance_documents where order_id in ({0})) and  exists (
select a.documents_id from tb_balance_documents a inner join tb_bill_receivable b on a.order_id=b.payable_single_id
where order_status in ('1','2') and a.documents_id =sale_billing_id
union all
select b.order_id from tb_account_verification a inner join tb_verificationn_documents b on a.account_verification_id=b.account_verification_id
where a.order_status in ('1','2') and b.order_id=sale_billing_id
);
update tb_parts_sale_order set is_occupy=@is_occupy where where sale_order_id in (select documents_id from tb_balance_documents where order_id in ({0})) and  exists (
select a.documents_id from tb_balance_documents a inner join tb_bill_receivable b on a.order_id=b.payable_single_id
where order_status in ('1','2') and a.documents_id =sale_order_id
union all
select b.order_id from tb_account_verification a inner join tb_verificationn_documents b on a.account_verification_id=b.account_verification_id
where a.order_status in ('1','2') and b.order_id=sale_order_id
);
update tb_maintain_settlement_info set is_occupy=@is_occupy where where settlement_id in (select documents_id from tb_balance_documents where order_id in ({0})) and  exists (
select a.documents_id from tb_balance_documents a inner join tb_bill_receivable b on a.order_id=b.payable_single_id
where order_status in ('1','2') and a.documents_id =settlement_id
union all
select b.order_id from tb_account_verification a inner join tb_verificationn_documents b on a.account_verification_id=b.account_verification_id
where a.order_status in ('1','2') and b.order_id=settlement_id
);
update tb_maintain_three_guaranty_settlement_yt set is_occupy=@is_occupy where where st_id in (select documents_id from tb_balance_documents where order_id in ({0})) and  exists (
select a.documents_id from tb_balance_documents a inner join tb_bill_receivable b on a.order_id=b.payable_single_id
where order_status in ('1','2') and a.documents_id =st_id
union all
select b.order_id from tb_account_verification a inner join tb_verificationn_documents b on a.account_verification_id=b.account_verification_id
where a.order_status in ('1','2') and b.order_id=st_id
);", files);
                        receivableSql.Param     = new Dictionary <string, string>();
                        receivableSql.Param.Add("is_occupy", ((int)DataSources.EnumImportStaus.OPEN).ToString());
                        //receivableSql.Param.Add("@id", files);
                    }
                    else
                    {
                        SysSQLString purchaseBillingSql = new SysSQLString();
                        purchaseBillingSql.cmdType   = CommandType.Text;
                        purchaseBillingSql.sqlString = string.Format(@"update tb_parts_purchase_billing set is_occupy=@is_occupy where purchase_billing_id in (select documents_id from tb_balance_documents where order_id in ({0})) and  exists (
select a.documents_id from tb_balance_documents a inner join tb_bill_receivable b on a.order_id=b.payable_single_id
where order_status in ('1','2') and a.documents_id =purchase_billing_id
union all
select b.order_id from tb_account_verification a inner join tb_verificationn_documents b on a.account_verification_id=b.account_verification_id
where a.order_status in ('1','2') and b.order_id=purchase_billing_id
);
                                                  update tb_parts_purchase_order set is_occupy=@is_occupy where order_id in (select documents_id from tb_balance_documents where order_id in ({0})) and  exists (
select a.documents_id from tb_balance_documents a inner join tb_bill_receivable b on a.order_id=b.payable_single_id
where order_status in ('1','2') and a.documents_id =order_id
union all
select b.order_id from tb_account_verification a inner join tb_verificationn_documents b on a.account_verification_id=b.account_verification_id
where a.order_status in ('1','2') and b.order_id=order_id
);  ", files);
                        purchaseBillingSql.Param     = new Dictionary <string, string>();
                        purchaseBillingSql.Param.Add("is_occupy", ((int)DataSources.EnumImportStaus.OPEN).ToString());
                        //purchaseBillingSql.Param.Add("@id", files);
                        listSql.Add(purchaseBillingSql);
                    }
                    //审核失败需重新计算已结算金额
                    foreach (DataGridViewRow dgvr in dgvBillReceivable.Rows)
                    {
                        if (Convert.ToBoolean(dgvr.Cells[colCheck.Name].EditedFormattedValue))
                        {
                            DataSources.EnumOrderType enumOrderType = (DataSources.EnumOrderType)Convert.ToInt32(dgvr.Cells[colOrderType.Name].Tag);
                            string order_id = dgvr.Cells[colPayableSingleID.Name].Value.ToString();
                            Financial.DocumentSettlementByBill(enumOrderType, order_id, listSql);
                        }
                    }
                }
                if (DBHelper.BatchExeSQLStringMultiByTrans("审核应收应付", listSql))
                {
                    MessageBoxEx.Show("审核成功!");
                    BindData();
                }
                else
                {
                    MessageBoxEx.Show("审核失败!");
                }
            }
        }
示例#14
0
        /// <summary>
        /// 添加收付款sql
        /// </summary>
        /// <param name="list"></param>
        static void AddReceivableSqlString(List <SysSQLString> list, tb_bill_receivable bill, decimal cash_money)
        {
            SysSQLString sql = new SysSQLString();

            sql.cmdType = CommandType.Text;
            sql.Param   = new Dictionary <string, string>();
            sql.Param.Add("payable_single_id", bill.payable_single_id);
            sql.Param.Add("order_num", bill.order_num);                                          //单号
            sql.Param.Add("order_date", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString()); //时间
            sql.Param.Add("order_status", ((int)DataSources.EnumAuditStatus.SUBMIT).ToString()); //单据状态
            sql.Param.Add("order_type", bill.order_type.ToString());                             //单据类型
            sql.Param.Add("cust_id", bill.cust_id);
            //sql.Param.Add("cust_code", bill.cust_code);//往来单位
            //sql.Param.Add("cust_name", bill.cust_name);//
            sql.Param.Add("payment_type", bill.payment_type.ToString());                                //收付款类型
            DataSources.EnumOrderType orderType = (DataSources.EnumOrderType)bill.order_type;
            sql.Param.Add("payment_money", DBOperation.GetAdvance(bill.cust_id, orderType).ToString()); //预付金额
            if (orderType == DataSources.EnumOrderType.RECEIVABLE)
            {
                sql.Param.Add("dealings_balance", DBOperation.GetReceivable(bill.cust_id).ToString());//往来余额
            }
            else
            {
                sql.Param.Add("dealings_balance", DBOperation.GetPayable(bill.cust_id).ToString());//往来余额
            }
            //sql.Param.Add("bank_of_deposit", bill.bank_of_deposit);//开户银行
            //sql.Param.Add("bank_account", bill.bank_account);//银行账户
            sql.Param.Add("org_id", GlobalStaticObj.CurrUserOrg_Id); //部门
            sql.Param.Add("org_name", GlobalStaticObj.CurrUserOrg_Name);
            sql.Param.Add("handle", GlobalStaticObj.UserID);         //经办人
            sql.Param.Add("handle_name", GlobalStaticObj.UserName);
            sql.Param.Add("operator", GlobalStaticObj.UserID);       //操作人
            sql.Param.Add("operator_name", GlobalStaticObj.UserName);
            //sql.Param.Add("remark", bill.remark);
            sql.Param.Add("create_by", GlobalStaticObj.UserID);
            sql.Param.Add("create_name", GlobalStaticObj.UserName);
            sql.Param.Add("create_time", Common.LocalDateTimeToUtcLong(DateTime.Now).ToString());
            sql.Param.Add("status", ((int)DataSources.EnumStatus.Start).ToString());
            sql.Param.Add("enable_flag", ((int)DataSources.EnumEnableFlag.USING).ToString());
            sql.Param.Add("com_id", GlobalStaticObj.CurrUserCom_Id);  //公司
            sql.Param.Add("com_name", GlobalStaticObj.CurrUserCom_Name);
            sql.Param.Add("cash_money", cash_money.ToString());       //收付金额
            sql.Param.Add("settlement_money", cash_money.ToString()); //结算金额
            if (bill.order_type == 0)
            {
                sql.sqlString = @"INSERT INTO [tb_bill_receivable]
           (payable_single_id,order_num ,order_date,order_status,order_type,cust_id,cust_code,cust_name,payment_type,payment_money,dealings_balance
,bank_of_deposit,bank_account,org_id,org_name,handle,handle_name,operator,operator_name,create_by,create_name,create_time,status,enable_flag,
com_id,com_name,cash_money,settlement_money)
select @payable_single_id,@order_num,@order_date,@order_status,@order_type,@cust_id,cust_code,cust_name,@payment_type,@payment_money,@dealings_balance,
bank_account_person,bank_account,@org_id,@org_name,@handle,@handle_name,@operator,@operator_name,@create_by,@create_name,@create_time,@status,@enable_flag,
@com_id,@com_name,@cash_money,@settlement_money 
from tb_customer where cust_id=@cust_id";
            }
            else
            {
                sql.sqlString = @"INSERT INTO [tb_bill_receivable]
           (payable_single_id,order_num ,order_date,order_status,order_type,cust_id,cust_code,cust_name,payment_type,payment_money,dealings_balance
,bank_of_deposit,bank_account,org_id,org_name,handle,handle_name,operator,operator_name,create_by,create_name,create_time,status,enable_flag,
com_id,com_name,cash_money,settlement_money)
select @payable_single_id,@order_num,@order_date,@order_status,@order_type,@cust_id,sup_code,sup_full_name,@payment_type,@payment_money,@dealings_balance,
null,null,@org_id,@org_name,@handle,@handle_name,@operator,@operator_name,@create_by,@create_name,@create_time,@status,@enable_flag,
@com_id,@com_name,@cash_money,@settlement_money 
from tb_supplier where sup_id =@cust_id";
            }
            list.Add(sql);
        }
 BusinessPrint businessPrint;//业务打印功能
 #endregion
 public UCReceivableManage(DataSources.EnumOrderType orderType)
 {
     InitializeComponent();
     //工具栏事件
     this.AddEvent += new ClickHandler(UCReceivableManage_AddEvent);
     this.EditEvent += new ClickHandler(UCReceivableManage_EditEvent);
     this.CopyEvent += new ClickHandler(UCReceivableManage_CopyEvent);
     this.DeleteEvent += new ClickHandler(UCReceivableManage_DeleteEvent);
     this.ViewEvent += new ClickHandler(UCReceivableManage_ViewEvent);
     this.VerifyEvent += new ClickHandler(UCReceivableManage_VerifyEvent);
     this.SubmitEvent += new ClickHandler(UCReceivableManage_SubmitEvent);
     this.PrintEvent += new ClickHandler(UCReceivableManage_PrintEvent);
     this.ExportEvent += new ClickHandler(UCReceivableManage_ExportEvent);
     base.SetEvent += new ClickHandler(UCReceivableManage_SetEvent);
     this.orderType = orderType;//单据类型
     DataGridViewEx.SetDataGridViewStyle(dgvBillReceivable, colOrderStatus);
     dgvBillReceivable.ReadOnly = false;
     dgvBillReceivable.HeadCheckChanged += new DataGridViewEx.DelegateOnClick(dgvBillReceivable_HeadCheckChanged);
     foreach (DataGridViewColumn dgvc in dgvBillReceivable.Columns)
     {
         if (dgvc.Name == colCheck.Name)
         {
             continue;
         }
         dgvc.ReadOnly = true;
     }
     SetLable();
     #region 打印预览
     string printObject = "tb_receivable";
     string printTitle = "财务收款单";
     if (orderType == DataSources.EnumOrderType.PAYMENT)
     {
         printObject = "tb_payment";
         printTitle = "财务付款单";
     }
     List<string> listNotPrint = new List<string>();
     listNotPrint.Add(colOrgId.Name);
     listNotPrint.Add(colHandle.Name);
     PaperSize paperSize = new PaperSize();
     paperSize.Width = 297;
     paperSize.Height = 210;
     businessPrint = new BusinessPrint(dgvBillReceivable, printObject, printTitle, paperSize, listNotPrint);
     #endregion
     //速查
     SetQuick();
     colDealingsBalance.ValueType = typeof(decimal);
     //负数格式化红色
     ControlsConfig.NegativeFormatting(dgvBillReceivable);
 }