Beispiel #1
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var leaseReturn = LeaseReturnService.Where(p => p.KeyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (leaseReturn != null)
            {
                ModifiedGrid();

                leaseReturn.FCode            = txtFCode.Text;
                leaseReturn.FName            = tbxFCustomer.Text;
                leaseReturn.FAddress         = txtFAddress.Text.Trim();
                leaseReturn.FCompanyId       = CurrentUser.AccountComId;
                leaseReturn.FFlag            = 1;
                leaseReturn.FDeleteFlag      = 0;
                leaseReturn.FLinkman         = txtFLinkman.Text.Trim();
                leaseReturn.FMemo            = txtFMemo.Text.Trim();
                leaseReturn.FPhone           = txtFPhone.Text.Trim();
                leaseReturn.FShipper         = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                leaseReturn.FVehicleNum      = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : "";
                leaseReturn.FSupercargo      = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                leaseReturn.FDriver          = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);
                leaseReturn.FPaymentRentals  = string.IsNullOrEmpty(txtFPaymentRentals.Text.Trim()) ? 0 : Convert.ToDecimal(txtFPaymentRentals.Text.Trim());
                leaseReturn.FDepositSecurity = string.IsNullOrEmpty(txtFDepositSecurity.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDepositSecurity.Text.Trim());

                leaseReturn.FSubjectCodeIn = ddlSubjectIn.SelectedValue;
                leaseReturn.FSubjectNameIn = ddlSubjectIn.SelectedText;

                leaseReturn.FSubjectCodeOut = ddlSubjectOut.SelectedValue;
                leaseReturn.FSubjectNameOut = ddlSubjectOut.SelectedText;
                leaseReturn.FSKNum          = "";
                leaseReturn.FCate           = hfdClass.Text;
                leaseReturn.FFKNum          = "";
                LeaseReturnService.SaveChanges();


                var parms = new Dictionary <string, object>();
                parms.Clear();
                parms.Add("@keyID", leaseReturn.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);
                var data = SqlService.ExecuteProcedureCommand("proc_LeaseReturnAmt", parms).Tables[0];

                for (int i = 0; i < data.Rows.Count; i++)
                {
                    int ids     = Convert.ToInt32(data.Rows[i]["FDetailsFId"]);
                    int qty     = Convert.ToInt32(data.Rows[i]["Qty"]);
                    var details = LeaseDetailsService.FirstOrDefault(p => p.FId == ids);
                    details.FReturnQty = details.FReturnQty + qty;
                    LeaseDetailsService.SaveChanges();
                }

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "TZ", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "8");
                    orderParms.Add("@companyId", CurrentUser.AccountComId);
                    SqlService.ExecuteProcedureCommand("proc_num", orderParms);
                    txtKeyId.Text = newKeyId;

                    //新增日志
                    var billStatus = new LHBillStatus
                    {
                        KeyId       = newKeyId,
                        FCompanyId  = CurrentUser.AccountComId,
                        FActionName = "新增",
                        FDate       = DateTime.Now,
                        FDeptId     = CurrentUser.AccountOrgId,
                        FOperator   = CurrentUser.AccountName,
                        FMemo       = String.Format("单据号{0},{1}新增租赁归还单据。", newKeyId, CurrentUser.AccountName)
                    };
                    GasHelper.AddBillStatus(billStatus);

                    //生成财务凭证
                    var parmsAuto = new Dictionary <string, object>();
                    parmsAuto.Clear();

                    parmsAuto.Add("@KeyId", newKeyId);
                    parmsAuto.Add("@companyId", CurrentUser.AccountComId);
                    parmsAuto.Add("@FCate", hfdClass.Text);
                    parmsAuto.Add("@date", Convert.ToDateTime(leaseReturn.FDate).ToString("yyyy-MM-dd"));
                    parmsAuto.Add("@FSKNum", leaseReturn.FSKNum);
                    parmsAuto.Add("@FAbstract", "退租");

                    SqlService.ExecuteProcedureCommand("proc_SFKLeaseReturnAuto", parmsAuto);
                }

                return(true);
            }


            return(false);
        }
Beispiel #2
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            switch (Actions)
            {
            case WebAction.Add:
                Region1.Title = "添加气瓶退租单";
                txtKeyId.Text = SequenceService.CreateSequence("TM", CurrentUser.AccountComId);
                var temp = new LHLeaseReturn
                {
                    KeyId = txtKeyId.Text,

                    FFlag = 1,

                    FDeleteFlag = 1,

                    //租金收款单
                    FType = Convert.ToInt32(GasEnumBill.LeaseReturn),

                    CreateBy = CurrentUser.AccountName,

                    FDate = txtFDate.SelectedDate,

                    FCompanyId = CurrentUser.AccountComId,

                    FStatus = Convert.ToInt32(GasEnumBillStauts.Add),

                    FProgress = Convert.ToInt32(GasEnumBillStauts.Add),
                };

                //临时写入单据
                LeaseReturnService.Add(temp);

                break;

            case WebAction.Edit:
                Region1.Title = "编辑气瓶退租单";
                txtKeyId.Text = KeyId;
                if (LeaseReturn != null)
                {
                    txtFCode.Text     = LeaseReturn.FCode;
                    tbxFCustomer.Text = LeaseReturn.FName;

                    txtFAddress.Text = LeaseReturn.FAddress;
                    //txtFFreight.Text = LeaseReturn.FFreight.ToString();

                    txtFLinkman.Text = LeaseReturn.FLinkman;
                    txtFMemo.Text    = LeaseReturn.FMemo;
                    txtFPhone.Text   = LeaseReturn.FPhone;

                    ddlFDriver.Text              = LeaseReturn.FDriver;
                    ddlFShipper.SelectedValue    = LeaseReturn.FShipper;
                    ddlFSupercargo.Text          = LeaseReturn.FSupercargo;
                    ddlFVehicleNum.SelectedValue = LeaseReturn.FVehicleNum;
                    hfdClass.Text = LeaseReturn.FCate;

                    ddlSubjectIn.SelectedValue  = LeaseReturn.FSubjectCodeIn;
                    ddlSubjectOut.SelectedValue = LeaseReturn.FSubjectCodeOut;
                    txtFDepositSecurity.Text    = LeaseReturn.FDepositSecurity.ToString();
                    txtFPaymentRentals.Text     = LeaseReturn.FPaymentRentals.ToString();


                    BindDataGrid();
                }
                break;
            }
        }
Beispiel #3
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (LeaseReturn != null)
            {
                ModifiedGrid();

                LeaseReturn.FCode      = txtFCode.Text;
                LeaseReturn.FName      = tbxFCustomer.Text;
                LeaseReturn.FAddress   = txtFAddress.Text.Trim();
                LeaseReturn.FCompanyId = CurrentUser.AccountComId;

                //StockOut.FDriver = !ddlFDriver.SelectedValue.Equals("-1") ? ddlFDriver.SelectedText : "";
                LeaseReturn.FShipper = !ddlFShipper.SelectedValue.Equals("-1") ? ddlFShipper.SelectedText : "";
                //StockOut.FSupercargo = !ddlFSupercargo.SelectedValue.Equals("-1") ? ddlFSupercargo.SelectedText : "";
                LeaseReturn.FVehicleNum = !ddlFVehicleNum.SelectedValue.Equals("-1") ? ddlFVehicleNum.SelectedText : "";


                LeaseReturn.FFlag = 1;
                //LeaseReturn.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                LeaseReturn.FLinkman = txtFLinkman.Text.Trim();
                LeaseReturn.FMemo    = txtFMemo.Text.Trim();
                LeaseReturn.FPhone   = txtFPhone.Text.Trim();

                LeaseReturn.FSupercargo = GasHelper.GetDropDownListArrayString(ddlFSupercargo.SelectedItemArray);
                LeaseReturn.FDriver     = GasHelper.GetDropDownListArrayString(ddlFDriver.SelectedItemArray);

                LeaseReturn.FPaymentRentals  = string.IsNullOrEmpty(txtFPaymentRentals.Text.Trim()) ? 0 : Convert.ToDecimal(txtFPaymentRentals.Text.Trim());
                LeaseReturn.FDepositSecurity = string.IsNullOrEmpty(txtFDepositSecurity.Text.Trim()) ? 0 : Convert.ToDecimal(txtFDepositSecurity.Text.Trim());

                LeaseReturn.FSubjectCodeIn  = ddlSubjectIn.SelectedValue;
                LeaseReturn.FSubjectNameIn  = ddlSubjectIn.SelectedText;
                LeaseReturn.FSubjectCodeOut = ddlSubjectOut.SelectedValue;
                LeaseReturn.FSubjectNameOut = ddlSubjectOut.SelectedText;
                LeaseReturn.FCate           = hfdClass.Text;
                LeaseReturn.CreateBy        = CurrentUser.AccountName;

                LeaseReturnService.SaveChanges();

                var parms = new Dictionary <string, object>();
                parms.Clear();
                parms.Add("@keyID", LeaseReturn.KeyId);
                parms.Add("@companyId", CurrentUser.AccountComId);

                var data = SqlService.ExecuteProcedureCommand("proc_LeaseReturnAmt", parms).Tables[0];
                for (int i = 0; i < data.Rows.Count; i++)
                {
                    int ids     = Convert.ToInt32(data.Rows[i]["FDetailsFId"]);
                    int qty     = Convert.ToInt32(data.Rows[i]["Qty"]);
                    var details = LeaseDetailsService.FirstOrDefault(p => p.FId == ids);
                    details.FReturnQty = details.FReturnQty + qty;
                    LeaseDetailsService.SaveChanges();
                }


                //生成财务凭证
                var parmsAuto = new Dictionary <string, object>();
                parmsAuto.Clear();

                parmsAuto.Add("@KeyId", LeaseReturn.KeyId);
                parmsAuto.Add("@companyId", CurrentUser.AccountComId);
                parmsAuto.Add("@FCate", hfdClass.Text);
                parmsAuto.Add("@date", Convert.ToDateTime(LeaseReturn.FDate).ToString("yyyy-MM-dd"));
                parmsAuto.Add("@FSKNum", LeaseReturn.FSKNum);
                parmsAuto.Add("@FAbstract", "退租");

                SqlService.ExecuteProcedureCommand("proc_SFKLeaseReturnAuto", parmsAuto);

                return(true);
            }
            return(false);
        }