Пример #1
0
        internal static void AddItemTable1(DataTable itemTable, Installment dataForm, WorkflowDataFields fields, string summaryAmount)
        {
            List<string> list = summaryAmount.Split(';').ToList<string>();
            list.Remove("");
            DataTable dt = new DataTable();
            dt.Columns.Add("ExpenseType");
            dt.Columns.Add("ItemAmount");
            dt.Columns.Add("CostCenter");
            dt.Columns.Add("GLAccount");
            dt.Columns.Add("PRWorkFlowNumber");
            dt.Columns.Add("SubPRNo");
            dt.Columns.Add("Title");
            dt.Columns.Add("FANO");
            dt.Columns.Add("ItemInstallmentAmount");
            //foreach (DataRow dr in itemTable.Rows)
            //{
            //    DataRow newdr = dt.Rows.Add();
            //    newdr["ExpenseType"] = dr["ExpenseType"].ToString();
            //    newdr["GLAccount"] = dr["GLAccount"].ToString();
            //    newdr["CostCenter"] = dr["CostCenter"].ToString();
            //    newdr["ItemAmount"] = dr["ItemAmount"].ToString();
            //    newdr["PRWorkFlowNumber"] = fields["Title"].ToString();
            //    newdr["SubPRNo"] = fields["SubPRNo"].ToString();
            //    newdr["Title"] = fields["SubPRNo"].ToString();
            //    newdr["FANO"] = dr["FANO"].AsString();
            //}
            for (int i = 0; i < itemTable.Rows.Count;i++ )
            {
                DataRow newdr = dt.Rows.Add();
                newdr["ExpenseType"] = itemTable.Rows[i]["ExpenseType"].ToString();
                newdr["GLAccount"] = itemTable.Rows[i]["GLAccount"].ToString();
                newdr["CostCenter"] = itemTable.Rows[i]["CostCenter"].ToString();
                newdr["ItemAmount"] = itemTable.Rows[i]["ItemAmount"].ToString();
                newdr["PRWorkFlowNumber"] = fields["Title"].ToString();
                newdr["SubPRNo"] = fields["SubPRNo"].ToString();
                newdr["Title"] = fields["SubPRNo"].ToString();
                newdr["FANO"] = itemTable.Rows[i]["FANO"].AsString();
                newdr["ItemInstallmentAmount"] = list[i].Trim();
            }

            dataForm.ItemTable = dt;
        }
Пример #2
0
 internal static void AddItemTable1(Installment dataForm, WorkflowDataFields fields)
 {
     AddItemTable1(dataForm.ItemTable, dataForm, fields, dataForm.SummaryAmount);
 }
Пример #3
0
 internal static void SaveSAPItemsDetails1(Installment dataForm)
 {
     BatchInsertSAPItems("PaymentRequestItemDetails", dataForm.ItemTable);
 }
Пример #4
0
        public bool SavePeymentRequestData(Installment installmentForm, WorkflowDataFields fields)
        {
            if (Session["ContractPONo"] == null || (Session["ContractPONo"] != null && Session["ContractPONo"].ToString() != txtContractPO.Text))
            {
                DataTable dTable = PaymentRequestComm.GetPaymentRequestInfoByContractPONo(txtContractPO.Text.ToUpper()).GetDataTable();
                if (dTable != null && dTable.Rows.Count > 0)
                {
                    ErrorMessage = " 您输入的合同编号已经存在,请重新输入 ";
                    return false;
                }
            }

            if ((PaymentRequestMode)Session["PRMode"] == PaymentRequestMode.New)
            {
                if (ViewState["PrDict"] == null)
                {
                    CreateWorkFlowNumber();
                }

                if (((Dictionary<string, string>)ViewState["PrDict"])["PIIndex"].ToString() == "1")
                {
                    SetPaymentRequestInfo();
                }
                else
                {
                    PaymentRequestComm.SetPaymentRequestInfo(PONO, new List<object[]>() {
                        new object[] { "Status", PaymentRequestStatus.InProcess },
                        new object[] { "ContractPO", txtContractPO.Text }
                        });
                }

                SetPaymentRequestUser(fields);
            }

            string paidInd = string.Empty;
            if (ViewState["Installment"] != null)
            {
                paidInd = (ViewState["Installment"] as DataTable).Rows[0]["PaidInd"].ToString();
            }

            if ((ViewState["Installment"] == null || paidInd == "1") && IsFromPO == false)
            {
                SetInstallmentInfo(installmentForm);
            }

            SetPaymentRequestItemsInfo(fields);

            return true;
        }
Пример #5
0
        private void SetInstallmentViewState(Installment installmentForm)
        {
            DataTable dTable = CreateInstalmentDT();
            DataRow dRow = dTable.NewRow();
            dRow["PaidBefore"] = 0;
            dRow["NewPaidBefore"] = 0;
            dRow["PaidInd"] = 1;
            dRow["Balance"] = 0;
            dRow["PaidThisTime"] = 100;
            if (radioInstallment.SelectedValue == "Yes" && string.IsNullOrEmpty(txtTotalAmount.Text) == false)
            {
                if (string.IsNullOrEmpty(((TextBox)installmentForm.InstallmentRepeaterControl.Items[0].FindControl("txtPaid")).Text) == false)
                {
                    dRow["Balance"] = radioInstallment.SelectedValue == "Yes" ? (100 - decimal.Parse(
                        ((TextBox)installmentForm.InstallmentRepeaterControl.Items[0].FindControl("txtPaid")).Text)).ToString() : "0";
                    dRow["PaidThisTime"] = radioInstallment.SelectedValue == "Yes" ?
                        ((TextBox)installmentForm.InstallmentRepeaterControl.Items[0].FindControl("txtPaid")).Text : "100";

                }
            }
            dTable.Rows.Add(dRow);
            ViewState["Installment"] = dTable;
        }
Пример #6
0
        /// <summary>
        /// 
        /// </summary>
        private void SetInstallmentInfo(Installment installmentForm)
        {
            SetInstallmentViewState(installmentForm);

            if ((PaymentRequestMode)Session["PRMode"] == PaymentRequestMode.Edit && IsFromPO == false)
            {
                PaymentRequestComm.DelInstallmentInfo(((Dictionary<string, string>)ViewState["PrDict"])["PONO"]);
            }

            List<List<object[]>> prInfos = new List<List<object[]>>();
            if (radioInstallment.SelectedValue == "Yes")
            {
                int i = 0;
                foreach (RepeaterItem rItem in installmentForm.InstallmentRepeaterControl.Items)
                {
                    AddInstallmentToList(prInfos, ++i, 0, ((TextBox)rItem.FindControl("txtPaid")).Text, ((TextBox)rItem.FindControl("txtPaidAmount")).Text, ((CheckBox)rItem.FindControl("txtIsNeedGR")).Checked ? "1" : "0",
                    ((TextBox)rItem.FindControl("txtComments")).Text, txtTotalAmount.Text, ((Dictionary<string, string>)ViewState["PrDict"])["PONO"], "分期第 " + i.ToString() + " 次付款");
                }
            }
            else
            {
                //一次性付款
                AddInstallmentToList(prInfos, 1, 0, 100, txtTotalAmount.Text, 0, "", txtTotalAmount.Text,
                ((Dictionary<string, string>)ViewState["PrDict"])["PONO"], "1 次性付款");
            }

            PaymentRequestComm.SetInstallmentInfo(prInfos);
        }