示例#1
0
        public ActionResult GetReceiptVoucherByInvoiceId(int custType, string _voucherInvoiceId)
        {
            BO_ReceiptVoucher obj = new BussinessObject.BO_ReceiptVoucher();

            obj = BL_ReceiptVoucher.GetReceiptVoucherByInvoiceId(custType, _voucherInvoiceId);
            return(Json(obj, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public static BO_ReceiptVoucher GetReceiptVoucherByInvoiceId(int custType, string _rvoucherInvoiceId)
        {
            BO_ReceiptVoucher _rvoucher = new BussinessObject.BO_ReceiptVoucher();

            using (AprosysAccountingEntities db = new AprosysAccountingEntities())
            {
                if (custType == 1)
                {
                    var obj = db.GetReceiptVoucherListByVoucherNO(_rvoucherInvoiceId, 0).ToList();
                    if (obj != null)
                    {
                        #region voucher object
                        _rvoucher.invoiceNo     = obj[0].InvoiceNo;
                        _rvoucher.rActivityDate = obj[0].ActivityTimestamp ?? BL_Common.GetDatetime();
                        _rvoucher.TypeId        = 1;
                        _rvoucher.rCustomerId   = obj[0].CustId;
                        _rvoucher.rRecived      = obj[0].Amount ?? 0;
                        _rvoucher.rComments     = obj[0].Comments ?? "";
                        _rvoucher.rGrossAmount  = 1;
                        _rvoucher.rbalance      = BL_Customer.GetCustomerBalance(obj[0].CustId) ?? 0;

                        #endregion
                    }
                }
                if (custType == 2)
                {
                    var obj = db.GetSubscriptionByVoucherNo(_rvoucherInvoiceId).ToList();
                    {
                        if (obj != null)
                        {
                            #region voucher object
                            _rvoucher.invoiceNo           = obj[0].InvoiceNo;
                            _rvoucher.rActivityDate       = obj[0].ActivityTimestamp ?? BL_Common.GetDatetime();
                            _rvoucher.TypeId              = 2;
                            _rvoucher.rCustomerId         = obj[0].CustId;
                            _rvoucher.rRecived            = obj[0].Amount ?? 0;
                            _rvoucher.rComments           = obj[0].Comments ?? "";
                            _rvoucher.rGrossAmount        = 1;
                            _rvoucher.rbalance            = BL_Customer.GetCustomerBalance(obj[0].CustId) ?? 0;
                            _rvoucher.DueDate             = BL_Customer.GetSubCustomerList(2).Where(x => x.Id == obj[0].CustId).FirstOrDefault().DueDate;
                            _rvoucher.rSubscriptionAmount = obj[0].SubscriptionAmount;
                            #endregion
                        }
                    }
                }
                return(_rvoucher);
            }
        }