public int Pay(BillingChld chld, CustAcnt acnt)
 {
     if (null == chld)
     {
         return(0);
     }
     return(service.UpdateAmount(chld, acnt));
 }
Ejemplo n.º 2
0
 public int UpdateAcnt(CustAcnt acnt)
 {
     if (null == acnt)
     {
         return(0);
     }
     return(service.UpdateAcnt(acnt));
 }
Ejemplo n.º 3
0
 public int AddCustAcnt(CustAcnt acnt)
 {
     if (null == acnt)
     {
         return(0);
     }
     return(service.AddCustAcnt(acnt));
 }
Ejemplo n.º 4
0
        public int UpdateAmount(BillingChld chld, CustAcnt acnt)
        {
            DateTime now = DateTime.Now;
            int      cnt = 0;
            Dictionary <string, object> values = null;
            long?acntId;

            if (null != acnt && null == acnt.ID__PK)
            {
                string acntSql = "SELECT MAX(ID) FROM CUST_ACNT WHERE AcntType=@type AND AcntNO=@acntNO AND CustID=@custId ";
                values = new Dictionary <string, object>();
                values.Add("type", acnt.AcntType);
                values.Add("acntNO", acnt.AcntNO);
                values.Add("custId", acnt.CustID);
                if (PAY_MODE.THIRD_PLATFORM == chld.PayMode)
                {
                    acnt.AcntType = ACNT_TYPE.THIRD_PLATFORM;
                    acntSql      += "AND Platform=@patf ";
                    values.Add("patf", acnt.Platform);
                }
                else if (PAY_MODE.BANK_TRANSFER == chld.PayMode)
                {
                    acnt.AcntType = ACNT_TYPE.BANCK_NO;
                    acnt.Platform = null;
                }
                Connector.Save <CustAcnt>(acnt);
                acntId = Connector.ScalarLong(acntSql, values);
            }
            else if (null != acnt && null != acnt.ID__PK)
            {
                acntId = (long)acnt.ID__PK;
            }
            else
            {
                acntId = null;
            }
            chld.OprtTmst = now;
            chld.AcntId   = acntId;
            cnt           = Connector.Save <BillingChld>(chld);
            string sql = "UPDATE BILLING SET FactAmount=(SELECT SUM(Amount) FROM BILLING_CHLD WHERE BillNO=@billNO) "
                         + "WHERE BillNO=@billNO";

            values = new Dictionary <string, object>();
            values.Add("billNO", chld.BillNO);
            cnt += Connector.DbHelper.ExecuteSql(sql, values);
            return(cnt);
        }
Ejemplo n.º 5
0
        public CustAcntForm(ICustomerManager manager, Customer cust, CustAcnt acnt)
        {
            InitializeComponent();
            this.manager  = manager;
            this.customer = cust;
            BindingSource tpBs = new BindingSource();

            tpBs.DataSource            = ACNT_TYPE.ACNT_MAP;
            cboxAcntType.DataSource    = tpBs;
            cboxAcntType.DisplayMember = "Value";
            cboxAcntType.ValueMember   = "Key";

            BindingSource ptBs = new BindingSource();

            ptBs.DataSource       = PLATFORM_NM.PLATFORM_MAP;
            cboxPlt.DataSource    = ptBs;
            cboxPlt.DisplayMember = "Value";
            cboxPlt.ValueMember   = "Key";

            if (null == acnt)
            {
                Text = "【新增账户】 " + customer.CName;
            }
            else
            {
                Text                       = "【修改账户】 " + customer.CName;
                txtAcntNO.Text             = acnt.AcntNO;
                cboxAcntType.SelectedValue = acnt.AcntType;
                cboxPlt.SelectedValue      = acnt.Platform;
                if (acnt.St == ST.INVALID)
                {
                    rbtnInvalid.Checked = true;
                }
                else if (acnt.St == ST.VALID)
                {
                    rbtnValid.Checked = true;
                }
                id = acnt.ID__PK;
            }
        }
Ejemplo n.º 6
0
        private void dtgvAcnt_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow curRow = dtgvAcnt.CurrentRow;

            if (null != curRow && null != cboxCust.SelectedItem)
            {
                Customer cust = cboxCust.SelectedItem as Customer;
                CustAcnt acnt = new CustAcnt();
                acnt.AcntNO   = StringUtil.Obj2Str(curRow.Cells[colAcntNO.Name].Value);
                acnt.AcntType = StringUtil.Obj2Str(curRow.Cells[colAcntType.Name].Value);
                acnt.CustID   = StringUtil.Obj2Int(curRow.Cells[colCustID.Name].Value);
                acnt.ID__PK   = StringUtil.Obj2Long(curRow.Cells[colID.Name].Value);
                acnt.Platform = StringUtil.Obj2Str(curRow.Cells[colPlatform.Name].Value);
                acnt.St       = StringUtil.Obj2Str(curRow.Cells[colSt.Name].Value);

                CustAcntForm acntForm = new CustAcntForm(manager, cust, acnt);
                DialogResult rslt     = acntForm.ShowDialog();
                if (DialogResult.OK == rslt)
                {
                    btnQuery_Click(btnQuery, new EventArgs());
                }
            }
        }
Ejemplo n.º 7
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            if (StringUtil.isEmpty(txtAcntNO.Text))
            {
                MessageBox.Show("请填写账户先!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            CustAcnt acnt = new CustAcnt();

            acnt.CustID   = customer.CID__PK;
            acnt.AcntNO   = txtAcntNO.Text;
            acnt.AcntType = StringUtil.Obj2Str(cboxAcntType.SelectedValue);
            string type = StringUtil.Obj2Str(cboxAcntType.SelectedValue);

            if (ACNT_TYPE.BANCK_NO == type)
            {
                acnt.Platform = null;
            }
            else if (ACNT_TYPE.THIRD_PLATFORM == type)
            {
                acnt.Platform = StringUtil.Obj2Str(cboxPlt.SelectedValue);
            }

            if (rbtnInvalid.Checked)
            {
                acnt.St = ST.INVALID;
            }
            else if (rbtnValid.Checked)
            {
                acnt.St = ST.VALID;
            }

            int exCnt = 0;

            try
            {
                if (null != id)
                {
                    acnt.ID__PK = id;
                    exCnt       = manager.UpdateAcnt(acnt);
                }
                else
                {
                    exCnt = manager.AddCustAcnt(acnt);
                }
            }
            catch
            {
                exCnt = 0;
            }

            if (exCnt > 0)
            {
                MessageBox.Show("保存成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                uptCnt++;
            }
            else
            {
                MessageBox.Show("保存失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 8
0
 public int UpdateAcnt(CustAcnt acnt)
 {
     return(Connector.Update <CustAcnt>(acnt));
 }
Ejemplo n.º 9
0
 public int AddCustAcnt(CustAcnt acnt)
 {
     return(Connector.Save <CustAcnt>(acnt));
 }
Ejemplo n.º 10
0
        private void btnCnfrm_Click(object sender, System.EventArgs e)
        {
            decimal?amount = null;

            try
            {
                amount = decimal.Parse(txtPymnt.Text.Trim());
            }
            catch
            {
                txtPymnt.Text = string.Empty;
                return;
            }
            if (billGoods.Amount - billGoods.FactAmount < amount)
            {
                MainForm.Warn("入账金额超出!");
                return;
            }
            int         cnt  = 0;
            BillingChld chld = new BillingChld();

            chld.BillNO    = billGoods.BillNO__PK;
            chld.PayMode   = StringUtil.Obj2Str(cboxPayMode.SelectedValue);
            chld.Amount    = amount;
            chld.OprtUsrId = MainForm.usr.UId__PK;

            CustAcnt custAcnt = new CustAcnt();

            if (PAY_MODE.CASH == chld.PayMode)
            {
                custAcnt = null;
            }
            else
            {
                if (null != autxtAcntNO.SelectedObj)
                {
                    custAcnt = autxtAcntNO.SelectedObj as CustAcnt;
                }
                else
                {
                    if (!StringUtil.isEmpty(autxtAcntNO.Term))
                    {
                        custAcnt.AcntNO = autxtAcntNO.Term.Trim();
                        custAcnt.CustID = custId;
                        custAcnt.St     = ST.VALID;
                        if (PAY_MODE.BANK_TRANSFER == chld.PayMode)
                        {
                            custAcnt.AcntType = ACNT_TYPE.BANCK_NO;
                            custAcnt.Platform = null;
                        }
                        else if (PAY_MODE.THIRD_PLATFORM == chld.PayMode)
                        {
                            custAcnt.AcntType = ACNT_TYPE.THIRD_PLATFORM;
                            custAcnt.Platform = StringUtil.Obj2Str(cboxPlatform.SelectedValue);
                        }
                    }
                    else
                    {
                        custAcnt = null;
                    }
                }
            }
            if (grade == GRADE.SUPPLIER)
            {
                cnt = supplierManager.Pay(chld, custAcnt);
            }
            else if (grade == GRADE.RESELLER)
            {
                cnt = resellerManager.Rcv(chld, custAcnt);
            }

            if (cnt < 1)
            {
                MainForm.Warn("操作失败!");
            }
            else
            {
                tabPymnt.SelectedTab = tabPChld;
                InitChldTable(billGoods.BillNO__PK);
                txtPymnt.Text              = string.Empty;
                cboxPayMode.SelectedIndex  = 0;
                cboxPlatform.SelectedIndex = 0;
                autxtAcntNO.clear();
            }
        }