Esempio n. 1
0
 private void SetWiring(Erp2016.Lib.CreditMemoPayout creditMemoPayout)
 {
     tbBankNameWiring.Text        = creditMemoPayout.BankName;
     tbBankAccountWiring.Text     = creditMemoPayout.BankAccountName;
     tbBankBranchAddrsWiring.Text = creditMemoPayout.BankBranchAddress;
     tbInstitutionWiring.Text     = creditMemoPayout.InstitutionNo;
     tbBranchNumWiring.Text       = creditMemoPayout.BranchNo;
     tbTransitNumWiring.Text      = creditMemoPayout.TransitNo;
     tbSwiftWiring.Text           = creditMemoPayout.SwiftCode;
     tbBankRoutingWiring.Text     = creditMemoPayout.BankRouting;
     tbAccountNumWiring.Text      = creditMemoPayout.AccountNo;
 }
Esempio n. 2
0
 public bool Update(CreditMemoPayout obj)
 {
     try
     {
         _db.SubmitChanges();
     }
     catch (Exception ex)
     {
         Debug.Print(ex.Message);
         return(false);
     }
     return(true);
 }
Esempio n. 3
0
 public int Add(CreditMemoPayout obj)
 {
     try
     {
         _db.CreditMemoPayouts.InsertOnSubmit(obj);
         _db.SubmitChanges();
     }
     catch (Exception ex)
     {
         Debug.Print(ex.Message);
         return(-1);
     }
     return(_db.CreditMemoPayouts.Max(x => x.CreditMemoPayoutId));
 }
Esempio n. 4
0
        public Erp2016.Lib.CreditMemoPayout GetData(Erp2016.Lib.CreditMemoPayout creditMemo)
        {
            creditMemo.ChkHolderName = string.Empty;
            creditMemo.ChkAddress    = string.Empty;
            creditMemo.ChkPhoneNum   = string.Empty;

            creditMemo.BankName          = string.Empty;
            creditMemo.BankAccountName   = string.Empty;
            creditMemo.BankBranchAddress = string.Empty;
            creditMemo.InstitutionNo     = string.Empty;
            creditMemo.BranchNo          = string.Empty;
            creditMemo.TransitNo         = string.Empty;
            creditMemo.SwiftCode         = string.Empty;
            creditMemo.BankRouting       = string.Empty;
            creditMemo.AccountNo         = string.Empty;

            creditMemo.PayoutMethod = RadTabStrip2.SelectedIndex + 1;
            switch (creditMemo.PayoutMethod)
            {
            // Credit
            case 1:
                break;

            // Cheque
            case 2:
                creditMemo.ChkHolderName = tbHolderNameCheque.Text;
                creditMemo.ChkAddress    = tbAddressCheque.Text;
                creditMemo.ChkPhoneNum   = tbPhoneNumberCheque.Text;
                break;

            // Wiring
            case 3:
                creditMemo.BankName          = tbBankNameWiring.Text;
                creditMemo.BankAccountName   = tbBankAccountWiring.Text;
                creditMemo.BankBranchAddress = tbBankBranchAddrsWiring.Text;
                creditMemo.InstitutionNo     = tbInstitutionWiring.Text;
                creditMemo.BranchNo          = tbBranchNumWiring.Text;
                creditMemo.TransitNo         = tbTransitNumWiring.Text;
                creditMemo.SwiftCode         = tbSwiftWiring.Text;
                creditMemo.BankRouting       = tbBankRoutingWiring.Text;
                creditMemo.AccountNo         = tbAccountNumWiring.Text;
                break;
            }

            return(creditMemo);
        }
Esempio n. 5
0
        public void SetData(Erp2016.Lib.CreditMemoPayout creditMemo)
        {
            if (creditMemo != null)
            {
                if (creditMemo.PayoutMethod != null)
                {
                    RadTabStrip2.SelectedIndex = (int)creditMemo.PayoutMethod - 1;

                    switch (creditMemo.PayoutMethod)
                    {
                    // Credit
                    case 1:
                        RadPageViewCredit.Selected = true;
                        break;

                    // Cheque
                    case 2:
                        RadPageViewCheque.Selected = true;
                        SetCheque(creditMemo);
                        break;

                    // Wiring
                    case 3:
                        RadPageViewWiring.Selected = true;
                        SetWiring(creditMemo);
                        break;
                    }
                }
                else
                {
                    SetCheque(new Erp2016.Lib.CreditMemoPayout());
                    SetWiring(new Erp2016.Lib.CreditMemoPayout());
                }
            }
            else
            {
                SetCheque(new Erp2016.Lib.CreditMemoPayout());
                SetWiring(new Erp2016.Lib.CreditMemoPayout());
            }
        }
Esempio n. 6
0
        protected void RadToolBar_ButtonClick(object sender, RadToolBarEventArgs e)
        {
            switch (e.Item.Text)
            {
            case "TempSave":
            case "Request":
                if (IsValid)
                {
                    var cC = new CCreditMemoPayout();
                    var c  = new Erp2016.Lib.CreditMemoPayout();

                    // new
                    if (Request["type"] == "0")
                    {
                        c              = new Erp2016.Lib.CreditMemoPayout();
                        c.CreatedId    = CurrentUserId;
                        c.CreatedDate  = DateTime.Now;
                        c.CreditMemoId = Id;
                    }
                    // modify
                    else
                    {
                        c = cC.Get(Id);
                    }

                    c                = CreditMemoPayout1.GetData(c);
                    c.Amount         = (decimal)RadNumericTextBoxAmount.Value;
                    c.IsActive       = true;
                    c.SiteLocationId = CurrentSiteLocationId;

                    int creditMemoPayoutId;

                    // new
                    if (Request["type"] == "0")
                    {
                        decimal availableAmount = new CCreditMemo().GetAvailableCreditAmount(Id);
                        if (availableAmount >= c.Amount)
                        {
                            decimal originalAmount = new CCreditMemo().GetOriginalCreditAmount(Id);
                            if ((originalAmount - availableAmount) + c.Amount < 0)
                            {
                                ShowMessage("result of available amount can't be negative amount");
                            }
                            else
                            {
                                creditMemoPayoutId = cC.Add(c);

                                // save file
                                FileDownloadList1.SaveFile(Id);

                                if (e.Item.Text == "TempSave")
                                {
                                    RunClientScript("Close();");
                                }
                                else
                                {
                                    if (SetReqeust(creditMemoPayoutId))
                                    {
                                        RunClientScript("Close();");
                                    }
                                    else
                                    {
                                        ShowMessage("error requesting");
                                    }
                                }
                            }
                        }
                        else
                        {
                            ShowMessage("paid amount is bigger than available credit amount");
                        }
                    }
                    // modify
                    else
                    {
                        c.UpdatedId   = CurrentUserId;
                        c.UpdatedDate = DateTime.Now;
                        cC.Update(c);

                        creditMemoPayoutId = c.CreditMemoPayoutId;

                        // save file
                        FileDownloadList1.SaveFile(Id);

                        if (SetReqeust(creditMemoPayoutId))
                        {
                            RunClientScript("Close();");
                        }
                        else
                        {
                            ShowMessage("error requesting");
                        }
                    }
                }
                break;

            case "Close":
                RunClientScript("Close();");
                break;
            }
        }
Esempio n. 7
0
 private void SetCheque(Erp2016.Lib.CreditMemoPayout creditMemo)
 {
     tbHolderNameCheque.Text  = creditMemo.ChkHolderName;
     tbAddressCheque.Text     = creditMemo.ChkAddress;
     tbPhoneNumberCheque.Text = creditMemo.ChkPhoneNum;
 }