Пример #1
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var order = SKOrderService.Where(p => p.keyId == txtKeyId.Text.Trim() && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();

            if (order != null)
            {
                order.FCode = txtFCode.Text;
                order.FName = tbxFCustomer.Text;
                //--------------------------------------------------
                order.FDeleteFlag = 0;
                order.FMemo       = txtFMemo.Text.Trim();
                order.CreateBy    = CurrentUser.AccountName;
                order.FDate       = txtFDate.SelectedDate;
                order.FAbstract   = ddlFAbstract.SelectedValue;
                order.FDate       = txtFDate.SelectedDate;
                //order.FVerificationFlag = 0;//未核销的

                var parms = new Dictionary <string, object>();
                parms.Clear();

                parms.Add("@KeyId", txtKeyId.Text.Trim());
                parms.Add("@companyId", CurrentUser.AccountComId);

                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SKOrderAmt", parms).Tables[0].Rows[0][0]);

                order.FAmount = amt;

                SKOrderService.SaveChanges();

                if (txtKeyId.Text.Contains("TM"))
                {
                    //单据号问题
                    string newKeyId   = SequenceService.CreateSequence(Convert.ToDateTime(txtFDate.SelectedDate), "SK", CurrentUser.AccountComId);
                    var    orderParms = new Dictionary <string, object>();
                    orderParms.Clear();
                    orderParms.Add("@oldKeyId", txtKeyId.Text);
                    orderParms.Add("@newKeyId", newKeyId);
                    orderParms.Add("@Bill", "12");
                    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);
                }

                return(true);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (SkOrder != null)
            {
                SkOrder.FCode     = txtFCode.Text;
                SkOrder.FName     = tbxFCustomer.Text;
                SkOrder.FAbstract = ddlFAbstract.SelectedValue;
                //------------------------------------------------------
                SkOrder.FDate = txtFDate.SelectedDate;

                //StockOut.FAddress = txtFAddress.Text.Trim();
                //CollectionOrder.FCompanyId = CurrentUser.AccountComId;

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

                //StockOut.FFlag = 1;

                //StockOut.FFreight = Convert.ToDecimal(txtFFreight.Text.Trim());
                //StockOut.FLinkman = txtFLinkman.Text.Trim();
                SkOrder.FMemo = txtFMemo.Text.Trim();
                //StockOut.FPhone = txtFPhone.Text.Trim();

                //var parms = new Dictionary<string, object>();
                //parms.Clear();

                //parms.Add("@keyID", CollectionOrder.keyId);
                //var amt =
                //    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SalesAmt", parms).Tables[0].Rows[0][0]);

                //CollectionOrder.FAmount = amt;

                //if (ddlFSupercargo.SelectedItem != null)
                //{
                //    var texts = new List<string>();
                //    foreach (ListItem item in ddlFSupercargo.SelectedItemArray)
                //    {
                //        texts.Add(item.Text);
                //    }
                //    if (!string.IsNullOrEmpty(String.Join(",", texts.ToArray())))
                //    {
                //        StockOut.FSupercargo = String.Join(",", texts.ToArray());
                //    }
                //}

                //if (ddlFDriver.SelectedItem != null)
                //{
                //    var texts = new List<string>();
                //    foreach (ListItem item in ddlFDriver.SelectedItemArray)
                //    {
                //        texts.Add(item.Text);
                //    }
                //    if (!string.IsNullOrEmpty(String.Join(",", texts.ToArray())))
                //    {
                //        StockOut.FDriver = String.Join(",", texts.ToArray());
                //    }
                //}

                var parms = new Dictionary <string, object>();
                parms.Clear();

                parms.Add("@KeyId", txtKeyId.Text.Trim());
                parms.Add("@companyId", CurrentUser.AccountComId);

                var amt =
                    Convert.ToDecimal(SqlService.ExecuteProcedureCommand("proc_SKOrderAmt", parms).Tables[0].Rows[0][0]);

                SkOrder.FAmount  = amt;
                SkOrder.CreateBy = CurrentUser.AccountName;

                return(SKOrderService.SaveChanges() >= 0);
            }
            return(false);
        }