Example #1
0
        public long Save(long tranId, DateTime valueDate, int storeId, string partyCode, int priceTypeId, string referenceNumber, string data, string statementReference, string attachmentsJSON)
        {
            if (!StockTransaction.IsValidStockTransactionByTransactionMasterId(tranId))
            {
                throw new InvalidOperationException(Resources.Warnings.InvalidStockTransaction);
            }

            if (!StockTransaction.IsValidPartyByTransactionMasterId(tranId, partyCode))
            {
                throw new InvalidOperationException(Resources.Warnings.InvalidParty);
            }

            Collection <StockDetail> details = CollectionHelper.GetStockMasterDetailCollection(data, storeId);

            if (!this.ValidateDetails(details, tranId))
            {
                return(0);
            }

            Collection <Attachment> attachments = CollectionHelper.GetAttachmentCollection(attachmentsJSON);

            int  officeId = CurrentSession.GetOfficeId();
            int  userId   = CurrentSession.GetUserId();
            long loginId  = CurrentSession.GetLogOnId();

            return(Data.Transactions.Return.PostTransaction(tranId, valueDate, officeId, userId, loginId, storeId, partyCode, priceTypeId, referenceNumber, statementReference, details, attachments));
        }
Example #2
0
        public void Reject(long tranId, string reason)
        {
            int       officeId             = CurrentSession.GetOfficeId();
            int       userId               = CurrentSession.GetUserId();
            long      loginId              = CurrentSession.GetLogOnId();
            const int verificationStatusId = -3;

            Transaction.Verify(tranId, officeId, userId, loginId, verificationStatusId, reason);
        }
        private long PostTransaction(string partyCode, string currencyCode, decimal amount, decimal debitExchangeRate, decimal creditExchangeRate, string referenceNumber, string statementReference, int costCenterId, int cashRepositoryId, DateTime?postedDate, int bankAccountId, string bankInstrumentCode, string bankTransactionCode)
        {
            int  userId   = CurrentSession.GetUserId();
            int  officeId = CurrentSession.GetOfficeId();
            long loginId  = CurrentSession.GetLogOnId();

            long transactionMasterID = Data.Transactions.Receipt.PostTransaction(userId, officeId, loginId, partyCode, currencyCode, amount, debitExchangeRate, creditExchangeRate, referenceNumber, statementReference, costCenterId, cashRepositoryId, postedDate, bankAccountId, bankInstrumentCode, bankTransactionCode);

            return(transactionMasterID);
        }
Example #4
0
        public bool Save(Collection <Data.Models.Reorder> details)
        {
            if (details == null)
            {
                throw new ArgumentNullException("details");
            }

            long loginId  = CurrentSession.GetLogOnId();
            int  userId   = CurrentSession.GetUserId();
            int  officeId = CurrentSession.GetOfficeId();

            return(Data.Transactions.Reorder.Save(loginId, userId, officeId, details));
        }
Example #5
0
        public long Save(DateTime valueDate, string referenceNumber, string statementReference, List <StockAdjustmentDetail> models)
        {
            foreach (var model in models)
            {
                if (model.TransferType == TransactionType.Credit)
                {
                    decimal existingQuantity = Data.Helpers.Items.CountItemInStock(model.ItemCode, model.UnitName, model.StoreName);

                    if (existingQuantity < model.Quantity)
                    {
                        throw new MixERPException(string.Format(CultureInfo.CurrentCulture, Errors.InsufficientStockWarning, Conversion.TryCastInteger(existingQuantity), model.UnitName, model.ItemName));
                    }
                }
            }

            int  officeId = CurrentSession.GetOfficeId();
            int  userId   = CurrentSession.GetUserId();
            long loginId  = CurrentSession.GetLogOnId();

            return(Data.Transactions.StockAdjustment.Add(officeId, userId, loginId, valueDate, referenceNumber, statementReference, models.ToCollection()));
        }
Example #6
0
        public static long Add(DateTime valueDate, string referenceNumber, int costCenterId, Collection <JournalDetail> details, Collection <Attachment> attachments)
        {
            long transactionMasterId = Add(valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, details, attachments);

            return(transactionMasterId);
        }
Example #7
0
        public static long Add(DateTime valueDate, int storeId, string partyCode, int priceTypeId, int paymentTermId, Collection <StockDetail> details, int shipperId, string shippingAddressCode, decimal shippingCharge, int costCenterId, string referenceNumber, int agentId, string statementReference, Collection <int> transactionIdCollection, Collection <Attachment> attachments, bool nonTaxable)
        {
            StockMaster stockMaster = new StockMaster();

            stockMaster.PartyCode     = partyCode;
            stockMaster.IsCredit      = true; //Credit
            stockMaster.PaymentTermId = paymentTermId;

            stockMaster.PriceTypeId         = priceTypeId;
            stockMaster.ShipperId           = shipperId;
            stockMaster.ShippingAddressCode = shippingAddressCode;
            stockMaster.ShippingCharge      = shippingCharge;
            stockMaster.SalespersonId       = agentId;
            stockMaster.StoreId             = storeId;

            long transactionMasterId = GlTransaction.Add("Sales.Delivery", valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, statementReference, stockMaster, details, attachments, nonTaxable);


            return(transactionMasterId);
        }
Example #8
0
        public static long Add(DateTime valueDate, string partyCode, int priceTypeId, Collection <StockDetail> details, string referenceNumber, string statementReference, Collection <long> transactionIdCollection, Collection <Attachment> attachments, bool nonTaxable, int salesPersonId, int shipperId, string shippingAddressCode, int storeId)
        {
            StockMaster stockMaster = new StockMaster();

            stockMaster.PartyCode           = partyCode;
            stockMaster.PriceTypeId         = priceTypeId;
            stockMaster.SalespersonId       = salesPersonId;
            stockMaster.ShipperId           = shipperId;
            stockMaster.ShippingAddressCode = shippingAddressCode;
            stockMaster.StoreId             = storeId;

            long nonGlStockMasterId = NonGlStockTransaction.Add("Sales.Order", valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), referenceNumber, statementReference, stockMaster, details, transactionIdCollection, attachments, nonTaxable);

            return(nonGlStockMasterId);
        }
        public static long Add(DateTime valueDate, int storeId, bool isCredit, string partyCode, Collection <StockDetail> details, int costCenterId, string referenceNumber, string statementReference, Collection <Attachment> attachments)
        {
            StockMaster stockMaster = new StockMaster();

            stockMaster.PartyCode = partyCode;
            stockMaster.StoreId   = storeId;
            stockMaster.IsCredit  = isCredit;

            if (!string.IsNullOrWhiteSpace(statementReference))
            {
                statementReference = statementReference.Replace("&nbsp;", " ").Trim();
            }

            long transactionMasterId = GlTransaction.Add(valueDate, "Purchase.Direct", CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), costCenterId, referenceNumber, statementReference, stockMaster, details, new Collection <long>(), attachments);

            return(transactionMasterId);
        }
Example #10
0
        public static long Add(string book, DateTime valueDate, string partyCode, int priceTypeId, Collection <StockDetail> details, string referenceNumber, string statementReference, Collection <long> transactionIdCollection, Collection <Attachment> attachments)
        {
            StockMaster stockMaster = new StockMaster();

            stockMaster.PartyCode   = partyCode;
            stockMaster.PriceTypeId = priceTypeId;

            long nonGlStockMasterId = NonGlStockTransaction.Add(book, valueDate, CurrentSession.GetOfficeId(), CurrentSession.GetUserId(), CurrentSession.GetLogOnId(), referenceNumber, statementReference, stockMaster, details, transactionIdCollection, attachments);

            return(nonGlStockMasterId);
        }