Пример #1
0
        /// <summary>
        /// 根据lmshop_CostReportBill表的BillId字段更新数据
        /// </summary>
        /// <param name="lmshopCostReportBillInfo">lmshopCostReportBillInfo</param>
        /// <returns></returns>
        public bool Updatelmshop_CostReportBillByBillId(CostReportBillInfo lmshopCostReportBillInfo)
        {
            string sql = "update [lmshop_CostReportBill] set [ReportId] = @ReportId,[BillUnit]=@BillUnit,[BillDate] = @BillDate,[BillNo] = @BillNo,[BillCode] = @BillCode,[NoTaxAmount] = @NoTaxAmount,[Tax] = @Tax,[TaxAmount] = @TaxAmount,[BillState] = @BillState,[OperatingTime] = @OperatingTime,[Memo] = @Memo,[Remark]=@Remark,[IsPay]=@IsPay,[IsPass]=@IsPass where [BillId] = @BillId";

            SqlParameter[] paras = PrepareCommandParameters(lmshopCostReportBillInfo);
            return(SqlHelper.ExecuteNonQuery(GlobalConfig.ERP_DB_NAME, false, sql, paras) > 0);
        }
Пример #2
0
        /// <summary>
        /// 向lmshop_CostReportBill表插入一条数据
        /// </summary>
        /// <param name="lmshopCostReportBill">lmshopCostReportBill</param>
        /// <returns></returns>
        public bool Addlmshop_CostReportBill(CostReportBillInfo lmshopCostReportBill)
        {
            string sql = "insert into [lmshop_CostReportBill]([BillId],[ReportId],[BillUnit],[BillDate],[BillNo],[BillCode],[NoTaxAmount],[Tax],[TaxAmount],[BillState],[OperatingTime],[Memo],[Remark],[IsPay],[IsPass])values(@BillId,@ReportId,@BillUnit,@BillDate,@BillNo,@BillCode,@NoTaxAmount,@Tax,@TaxAmount,@BillState,@OperatingTime,@Memo,@Remark,@IsPay,@IsPass)";

            SqlParameter[] paras = PrepareCommandParameters(lmshopCostReportBill);
            return(SqlHelper.ExecuteNonQuery(GlobalConfig.ERP_DB_NAME, false, sql, paras) > 0);
        }
        //批量操作
        protected void btn_Pass_Click(object sender, EventArgs e)
        {
            var errorMsg = new StringBuilder();

            if (!string.IsNullOrEmpty(Hid_BillId.Value))
            {
                var billIds = Hid_BillId.Value.Split(',');
                foreach (var item in billIds)
                {
                    CostReportBillInfo model = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(item));
                    if (!model.BillState.ToString().Equals(ddl_BillState.SelectedValue))
                    {
                        errorMsg.Append("“票据号码:").Append(model.BillNo).Append("”不符合“" + ddl_BillState.SelectedItem.Text + "”状态!").Append("\\n");
                        continue;
                    }
                    try
                    {
                        BatchPass(model);
                    }
                    catch
                    {
                        errorMsg.Append("“票据号码:").Append(model.BillNo).Append("”保存失败!").Append("\\n");
                    }
                }
                if (!string.IsNullOrEmpty(errorMsg.ToString()))
                {
                    MessageBox.Show(this, errorMsg.ToString());
                }
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
        }
        //票据接收
        protected void imgbtn_Receive_Click(object sender, EventArgs e)
        {
            var billId               = ((ImageButton)sender).CommandArgument;
            var invoiceType          = ((ImageButton)sender).CommandName;
            CostReportBillInfo model = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId));

            if (model.BillState.Equals((int)CostReportBillState.Submit))
            {
                int    state;
                string remarkMsg = string.Empty;
                if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.VatInvoice))
                {
                    state     = (int)CostReportBillState.Receive;
                    remarkMsg = "【接收票据】";
                }
                else
                {
                    state     = (int)CostReportBillState.Verification;
                    remarkMsg = "【票据认证完成】";
                }
                var remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime(remarkMsg);
                _costReportBill.Updatelmshop_CostReportBillByBillId(remark, new Guid(billId), state);
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            else
            {
                MessageBox.Show(this, "状态已更新,不允许此操作!");
            }
        }
Пример #5
0
        //初始化页面数据
        protected void LoadBillData(string billId)
        {
            CostReportBillInfo model = CostReportBillInfo = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId));

            txt_BillUnit.Text    = model.BillUnit;
            txt_BillDate.Text    = DateTime.Parse(model.BillDate.ToString()).ToString("yyyy-MM-dd");
            txt_NoTaxAmount.Text = model.NoTaxAmount.ToString(CultureInfo.InvariantCulture);
            txt_Tax.Text         = model.Tax.ToString(CultureInfo.InvariantCulture);
            txt_BillNo.Text      = model.BillNo;
            txt_TaxAmount.Text   = model.TaxAmount.ToString(CultureInfo.InvariantCulture);
            txt_BillCode.Text    = model.BillCode;
            txt_BillState.Text   = EnumAttribute.GetKeyName((CostReportBillState)model.BillState);
            txt_Memo.Text        = model.Memo;

            var invoiceType = Request.QueryString["InvoiceType"];

            if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.VatInvoice))
            {
                VatInvoice.Visible = true;
            }
            else if (int.Parse(invoiceType).Equals((int)CostReportInvoiceType.Voucher))
            {
                lit_BillNo.Text       = "收据";
                lit_TaxAmount.Visible = BillCode.Visible = txtBillCode.Visible = false;
            }
        }
Пример #6
0
        /// <summary>
        /// 返回lmshop_CostReportBill表的所有数据
        /// </summary>
        /// <returns></returns>
        public List <CostReportBillInfo> GetAlllmshop_CostReportBill()
        {
            List <CostReportBillInfo> lmshopCostReportBillList = new List <CostReportBillInfo>();
            IDataReader reader = null;

            string sql = SQL_SELECT;

            reader = SqlHelper.ExecuteReader(GlobalConfig.ERP_DB_NAME, true, sql, null);
            while (reader.Read())
            {
                CostReportBillInfo lmshopCostReportBill = new CostReportBillInfo(reader);
                lmshopCostReportBillList.Add(lmshopCostReportBill);
            }
            reader.Close();
            return(lmshopCostReportBillList);
        }
        //退回
        protected void imgbtn_Back_Click(object sender, EventArgs e)
        {
            var billId = ((ImageButton)sender).CommandArgument;
            CostReportBillInfo model = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId));

            if (!model.BillState.Equals((int)CostReportBillState.UnSubmit))
            {
                string remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime("【票据退回】");
                _costReportBill.Updatelmshop_CostReportBillByBillId(remark, new Guid(billId), (int)CostReportBillState.UnSubmit);
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            else
            {
                MessageBox.Show(this, "状态已更新,不允许此操作!");
            }
        }
Пример #8
0
        /// <summary>
        /// 根据lmshop_CostReportBill表的BillId字段返回数据
        /// </summary>
        /// <param name="billId">BillId</param>
        /// <returns></returns>
        public CostReportBillInfo Getlmshop_CostReportBillByBillId(Guid billId)
        {
            CostReportBillInfo lmshopCostReportBill = null;
            IDataReader        reader = null;

            string sql = SQL_SELECT + "where [BillId] = @BillId";

            SqlParameter[] paras = new SqlParameter[] {
                new SqlParameter("@BillId", billId)
            };
            reader = SqlHelper.ExecuteReader(GlobalConfig.ERP_DB_NAME, true, sql, paras);
            if (reader.Read())
            {
                lmshopCostReportBill = new CostReportBillInfo(reader);
            }
            reader.Close();
            return(lmshopCostReportBill);
        }
        //票据删除
        protected void imgbtn_Del_Click(object sender, EventArgs e)
        {
            var billId = ((ImageButton)sender).CommandArgument;
            CostReportBillInfo model = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId));

            if (model.BillState.Equals((int)CostReportBillState.UnSubmit))
            {
                var result = _costReportBill.Deletelmshop_CostReportBillByBillId(new Guid(billId));
                if (result)
                {
                    MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
                }
            }
            else
            {
                MessageBox.Show(this, "状态已更新,不允许此操作!");
            }
        }
Пример #10
0
        /// <summary>
        /// 根据lmshop_CostReportBill表的ReportId字段返回数据
        /// </summary>
        /// <param name="reportId">ReportId</param>
        /// <returns></returns>
        public List <CostReportBillInfo> Getlmshop_CostReportBillByReportId(Guid reportId)
        {
            List <CostReportBillInfo> lmshopCostReportBillList = new List <CostReportBillInfo>();

            string sql = SQL_SELECT + "where [ReportId] = @ReportId";

            SqlParameter[] paras = new SqlParameter[] {
                new SqlParameter("@ReportId", reportId)
            };
            var reader = SqlHelper.ExecuteReader(GlobalConfig.ERP_DB_NAME, true, sql, paras);

            while (reader.Read())
            {
                CostReportBillInfo lmshopCostReportBill = new CostReportBillInfo(reader);
                lmshopCostReportBillList.Add(lmshopCostReportBill);
            }
            reader.Close();
            return(lmshopCostReportBillList);
        }
Пример #11
0
 /// <summary>
 /// prepare parameters
 /// </summary>
 public static SqlParameter[] PrepareCommandParameters(CostReportBillInfo lmshopCostReportBillInfo)
 {
     SqlParameter[] paras = new SqlParameter[] {
         new SqlParameter("@BillId", lmshopCostReportBillInfo.BillId),
         new SqlParameter("@ReportId", lmshopCostReportBillInfo.ReportId),
         new SqlParameter("@BillUnit", lmshopCostReportBillInfo.BillUnit),
         new SqlParameter("@BillDate", lmshopCostReportBillInfo.BillDate),
         new SqlParameter("@BillNo", lmshopCostReportBillInfo.BillNo),
         new SqlParameter("@BillCode", lmshopCostReportBillInfo.BillCode),
         new SqlParameter("@NoTaxAmount", lmshopCostReportBillInfo.NoTaxAmount),
         new SqlParameter("@Tax", lmshopCostReportBillInfo.Tax),
         new SqlParameter("@TaxAmount", lmshopCostReportBillInfo.TaxAmount),
         new SqlParameter("@BillState", lmshopCostReportBillInfo.BillState),
         new SqlParameter("@OperatingTime", lmshopCostReportBillInfo.OperatingTime),
         new SqlParameter("@Memo", lmshopCostReportBillInfo.Memo),
         new SqlParameter("@Remark", lmshopCostReportBillInfo.Remark),
         new SqlParameter("@IsPay", lmshopCostReportBillInfo.IsPay),
         new SqlParameter("@IsPass", lmshopCostReportBillInfo.IsPass)
     };
     return(paras);
 }
        protected void BatchPass(CostReportBillInfo model)
        {
            #region 票据提交
            if (int.Parse(ddl_BillState.SelectedValue).Equals((int)CostReportBillState.UnSubmit))
            {
                string remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime("【提交票据】");
                _costReportBill.Updatelmshop_CostReportBillByBillId(remark, model.BillId, (int)CostReportBillState.Submit);
            }
            #endregion

            #region 票据接收
            if (int.Parse(ddl_BillState.SelectedValue).Equals((int)CostReportBillState.Submit))
            {
                int    state;
                string remarkMsg = string.Empty;
                if (!model.Tax.Equals(0))//增值税专用发票
                {
                    state     = (int)CostReportBillState.Receive;
                    remarkMsg = "【接收票据】";
                }
                else
                {
                    state     = (int)CostReportBillState.Verification;
                    remarkMsg = "【票据认证完成】";
                }
                var remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime(remarkMsg);
                _costReportBill.Updatelmshop_CostReportBillByBillId(remark, model.BillId, state);
            }
            #endregion

            #region 完成认证
            if (int.Parse(ddl_BillState.SelectedValue).Equals((int)CostReportBillState.Finish))
            {
                string remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime("【票据认证完成】");
                _costReportBill.Updatelmshop_CostReportBillByBillId(remark, model.BillId, (int)CostReportBillState.Verification);
            }
            #endregion
        }
        //增票待认证(无需认证)
        protected void btn_NoAuthenticate_Click(object sender, EventArgs e)
        {
            var errorMsg = new StringBuilder();

            if (!string.IsNullOrEmpty(Hid_BillId.Value))
            {
                var billIds = Hid_BillId.Value.Split(',');
                foreach (var item in billIds)
                {
                    CostReportBillInfo model = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(item));
                    if (!model.BillState.Equals((int)CostReportBillState.Receive))
                    {
                        errorMsg.Append("“票据号码:").Append(model.BillNo).Append("”不符合“" + EnumAttribute.GetKeyName(CostReportBillState.Receive) + "”状态!").Append("\\n");
                        continue;
                    }
                    try
                    {
                        string remark = ERP.UI.Web.Common.WebControl.RetrunUserAndTime("【票据认证完成】");
                        _costReportBill.Updatelmshop_CostReportBillByBillId(remark, new Guid(item), (int)CostReportBillState.Verification);
                    }
                    catch
                    {
                        errorMsg.Append("“票据号码:").Append(model.BillNo).Append("”保存失败!").Append("\\n");
                    }
                }
                MessageBox.AppendScript(this, "setTimeout(function(){ refreshGrid(); }, " + GlobalConfig.PageAutoRefreshDelayTime + ");");
            }
            else
            {
                errorMsg.Append("请选择相关数据!");
            }
            if (!string.IsNullOrEmpty(errorMsg.ToString()))
            {
                MessageBox.Show(this, errorMsg.ToString());
            }
        }
Пример #14
0
 //初始化页面数据
 protected void LoadBillData(string billId)
 {
     CostReportBillInfo model = CostReportBillInfo = _costReportBill.Getlmshop_CostReportBillByBillId(new Guid(billId));
 }