private void 月度预算申请表_Form_btnPrint(object sender, EventArgs e)
        {
            IBudgetMonth serviceBudgetMonth = Service_Economic_Financial.ServerModuleFactory.GetServerModule <IBudgetMonth>();

            if (tabControl1.SelectedTab.Text == "全部")
            {
                MessageDialog.ShowPromptMessage("请选择【已处理】或【待处理】中的记录");
                return;
            }

            string billNo = "";

            if (tabControl1.SelectedTab.Text == "已处理")
            {
                if (dataGridView2.Rows.Count > 0)
                {
                    billNo = dataGridView2.CurrentRow.Cells["业务编号"].Value.ToString();
                }
            }
            else if (tabControl1.SelectedTab.Text == "待处理")
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    billNo = dataGridView1.CurrentRow.Cells["业务编号"].Value.ToString();
                }
            }

            Business_Finance_Budget_Month billInfo = serviceBudgetMonth.GetBillSingleInfo(billNo);
            DataTable tempTable = serviceBudgetMonth.GetDetailInfo(billInfo);

            ExcelHelperP.DataTableToExcel(saveFileDialog1, tempTable, null);
        }
Exemplo n.º 2
0
        public DataTable GetDetailInfo(Business_Finance_Budget_Month billInfo)
        {
            string error = null;

            Hashtable hsTable = new Hashtable();

            hsTable.Add("@BillNo", billInfo.BillNo);
            hsTable.Add("@Year", billInfo.YearValue);
            hsTable.Add("@Month", billInfo.MonthValue);
            hsTable.Add("@DeptCode", billInfo.DeptCode);

            return(GlobalObject.DatabaseServer.QueryInfoPro("Business_Finance_Get_BudgetMonthDetail", hsTable, out error));
        }
        private bool 月度预算申请表_Form_CommonProcessSubmit(CustomFlowForm form, string advise)
        {
            IBudgetMonth servcieMonth = Service_Economic_Financial.ServerModuleFactory.GetServerModule <IBudgetMonth>();

            try
            {
                this.OperationType = form.FlowOperationType;
                this.BillNo        = form.FlowInfo_BillNo;
                Business_Finance_Budget_Month monthInfo = form.ResultInfo as Business_Finance_Budget_Month;

                DataTable detailTable = form.ResultList[0] as DataTable;

                switch (this.OperationType)
                {
                case CE_FlowOperationType.提交:
                    servcieMonth.SaveInfo(detailTable, monthInfo);
                    servcieMonth.OperationBusiness(detailTable, this.BillNo);
                    break;

                case CE_FlowOperationType.暂存:
                    servcieMonth.SaveInfo(detailTable, monthInfo);
                    break;

                case CE_FlowOperationType.回退:
                    break;

                case CE_FlowOperationType.未知:
                    break;

                default:
                    break;
                }

                if (!servcieMonth.IsExist(this.BillNo))
                {
                    MessageDialog.ShowPromptMessage("数据为空,保存失败,如需退出,请直接X掉界面");
                    return(false);
                }

                return(true);
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
                return(false);
            }
        }
Exemplo n.º 4
0
        public void OperationBusiness(DataTable detailTable, string billNo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;
            IFlowServer serviceFlow        = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();

            try
            {
                if (serviceFlow.GetNextBillStatus(billNo) != CE_CommonBillStatus.单据完成.ToString())
                {
                    return;
                }

                Business_Finance_Budget_Month billInfo = GetBillSingleInfo(ctx, billNo);

                if (billInfo == null)
                {
                    throw new Exception("单据不存在");
                }

                var varDetail = from a in ctx.Business_Finance_Budget_MonthDetail
                                where a.BillNo == billInfo.BillNo
                                select a;

                foreach (Business_Finance_Budget_MonthDetail detail in varDetail)
                {
                    var varInfo = from a in ctx.Business_Finance_BudgetInfo
                                  where a.DeptCode == billInfo.DeptCode &&
                                  a.YearValue == billInfo.YearValue &&
                                  a.MonthValue == billInfo.MonthValue &&
                                  a.ProjectID == detail.ProjectID
                                  select a;

                    if (varInfo.Count() == 1)
                    {
                        varInfo.Single().BudgetAmountMonth = detail.BudgetAmount;
                        varInfo.Single().ActualAmount      = detail.ActualAmount;
                    }
                }

                ctx.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 5
0
        public override void LoadFormInfo()
        {
            try
            {
                txtBillNo.Text    = this.FlowInfo_BillNo;
                lbBillStatus.Text = _ServiceFlow.GetNowBillStatus(this.FlowInfo_BillNo);

                cmbYearValue.MaxYear = 2025;
                cmbYearValue.MinYear = 2015;
                cmbYearValue.Init();

                cmbMonthValue.Init <CE_MonthValue>();

                _LnqBillInfo = _ServiceMonth.GetBillSingleInfo(this.FlowInfo_BillNo);

                if (_LnqBillInfo == null)
                {
                    _LnqBillInfo = new Business_Finance_Budget_Month();

                    _LnqBillInfo.MonthValue = ServerTime.Time.Month;
                    _LnqBillInfo.YearValue  = ServerTime.Time.Year;
                    _LnqBillInfo.BillNo     = txtBillNo.Text;
                    _LnqBillInfo.DeptCode   = UniversalFunction.GetDept_Belonge(BasicInfo.DeptCode).DeptCode;
                }

                cmbYearValue.Text  = _LnqBillInfo.YearValue.ToString();
                cmbMonthValue.Text = GlobalObject.GeneralFunction.ValueConvertToEnum <CE_MonthValue>(Convert.ToInt32(_LnqBillInfo.MonthValue)).ToString();

                RefreshDataGridView();

                cmbYearValue.SelectedIndexChanged  += new EventHandler(cmbYearValue_SelectedIndexChanged);
                cmbMonthValue.SelectedIndexChanged += new EventHandler(cmbMonthValue_SelectedIndexChanged);

                if (lbBillStatus.Text != CE_CommonBillStatus.新建单据.ToString())
                {
                    cmbMonthValue.Enabled = false;
                    cmbYearValue.Enabled  = false;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Exemplo n.º 6
0
        public void SaveInfo(DataTable detailTable, Business_Finance_Budget_Month billInfo)
        {
            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;
            IFlowServer serviceFlow        = FlowControlService.ServerModuleFactory.GetServerModule <IFlowServer>();

            try
            {
                if (serviceFlow.GetNowBillStatus(billInfo.BillNo) == CE_CommonBillStatus.新建单据.ToString())
                {
                    if (detailTable == null)
                    {
                        throw new Exception("无明细信息,无法保存");
                    }

                    var varDetail = from a in ctx.Business_Finance_Budget_MonthDetail
                                    where a.BillNo == billInfo.BillNo
                                    select a;

                    var varBill = from a in ctx.Business_Finance_Budget_Month
                                  where a.BillNo == billInfo.BillNo
                                  select a;

                    ctx.Business_Finance_Budget_MonthDetail.DeleteAllOnSubmit(varDetail);
                    ctx.Business_Finance_Budget_Month.DeleteAllOnSubmit(varBill);

                    billInfo.DeptCode = UniversalFunction.GetDept_Belonge(ctx, BasicInfo.DeptCode).DeptCode;
                    ctx.Business_Finance_Budget_Month.InsertOnSubmit(billInfo);

                    List <Business_Finance_Budget_MonthDetail> lstDetail = new List <Business_Finance_Budget_MonthDetail>();
                    Business_Finance_Budget_MonthDetail        detail    = new Business_Finance_Budget_MonthDetail();

                    foreach (DataRow dr in detailTable.Rows)
                    {
                        decimal yeardec  = Convert.ToDecimal(dr["年度预算"]);
                        decimal monthdec = Convert.ToDecimal(dr["月度预算"]);

                        if (monthdec > 0 && monthdec >= yeardec * (decimal)1.2 &&
                            GlobalObject.GeneralFunction.IsNullOrEmpty(dr["差异说明(年)"].ToString()))
                        {
                            throw new Exception("请填写【差异说明(年)】");
                        }

                        detail = new Business_Finance_Budget_MonthDetail();

                        detail.BillNo               = billInfo.BillNo;
                        detail.BudgetAmount         = dr["月度预算"] == null ? 0 : Convert.ToDecimal(dr["月度预算"]);
                        detail.ProjectID            = dr["科目ID"].ToString();
                        detail.ActualAmount         = 0;
                        detail.DifferenceRemarkYear = dr["差异说明(年)"] == null ? "" : dr["差异说明(年)"].ToString();

                        lstDetail.Add(detail);
                    }

                    ctx.Business_Finance_Budget_MonthDetail.InsertAllOnSubmit(lstDetail);
                }
                else if (serviceFlow.GetNextBillStatus(billInfo.BillNo) == CE_CommonBillStatus.等待确认.ToString())
                {
                    foreach (DataRow dr in detailTable.Rows)
                    {
                        var varDataDetail = from a in ctx.Business_Finance_Budget_MonthDetail
                                            where a.BillNo == billInfo.BillNo &&
                                            a.ProjectID == dr["科目ID"].ToString()
                                            select a;

                        if (varDataDetail.Count() == 1)
                        {
                            varDataDetail.Single().ActualAmount = dr["实际金额"] == null ? 0 : Convert.ToDecimal(dr["实际金额"]);
                        }
                    }
                }
                else if (serviceFlow.GetNextBillStatus(billInfo.BillNo) == CE_CommonBillStatus.单据完成.ToString())
                {
                    foreach (DataRow dr in detailTable.Rows)
                    {
                        decimal monthdec  = Convert.ToDecimal(dr["月度预算"]);
                        decimal actarldec = Convert.ToDecimal(dr["实际金额"]);

                        if (actarldec > 0 && actarldec >= monthdec * (decimal)1.2 &&
                            GlobalObject.GeneralFunction.IsNullOrEmpty(dr["差异说明(月)"].ToString()))
                        {
                            throw new Exception("请填写【差异说明(月)】");
                        }

                        var varDataDetail = from a in ctx.Business_Finance_Budget_MonthDetail
                                            where a.BillNo == billInfo.BillNo &&
                                            a.ProjectID == dr["科目ID"].ToString()
                                            select a;

                        if (varDataDetail.Count() == 1)
                        {
                            varDataDetail.Single().DifferenceRemarkMonth = dr["差异说明(月)"] == null ? "" : dr["差异说明(月)"].ToString();
                        }
                    }
                }

                ctx.SubmitChanges();
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }