コード例 #1
0
        // GET: ManageConfigurations/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ManageConfiguration manageConfiguration = UnitOfWork.ManageConfigurationRepository.GetById(id.Value);

            if (manageConfiguration == null)
            {
                return(HttpNotFound());
            }
            return(View(manageConfiguration));
        }
コード例 #2
0
        public ActionResult Create(ManageConfiguration manageConfiguration)
        {
            if (ModelState.IsValid)
            {
                manageConfiguration.IsDeleted    = false;
                manageConfiguration.CreationDate = DateTime.Now;
                manageConfiguration.Id           = Guid.NewGuid();
                UnitOfWork.ManageConfigurationRepository.Insert(manageConfiguration);
                UnitOfWork.Save();
                return(RedirectToAction("Index"));
            }

            return(View(manageConfiguration));
        }
コード例 #3
0
        public ActionResult FinalizeExit(string exitId, string cutAmount, string otherAmount, string weighbridgeAmount,
                                         string loadAmount, string inventoryAmount, string vatAmount,
                                         string receivedInventoryAmount, string receivedCutAmount,
                                         string receivedLoadAmount, string receivedVatAmount,
                                         string customer, string inventoryCustomer, string cutCustomer, string loadCustomer, string vatCustomer)
        {
            try
            {
                Guid id = new Guid(exitId);

                Exit exit = UnitOfWork.ExitRepository.GetById(id);

                ManageConfiguration configuration = UnitOfWork.ManageConfigurationRepository.Get().FirstOrDefault();

                decimal subTotalAmount = Convert.ToDecimal(inventoryAmount) + Convert.ToDecimal(loadAmount) +
                                         Convert.ToDecimal(cutAmount) +
                                         Convert.ToDecimal(otherAmount) + Convert.ToDecimal(weighbridgeAmount);

                decimal vat = subTotalAmount * (configuration.VAT / 100);

                decimal totalAmount = vat + subTotalAmount;

                exit.InventoryAmount   = Convert.ToDecimal(inventoryAmount);
                exit.LoadAmount        = Convert.ToDecimal(loadAmount);
                exit.CutAmount         = Convert.ToDecimal(cutAmount);
                exit.OtherAmount       = Convert.ToDecimal(otherAmount);
                exit.WeighbridgeAmount = Convert.ToDecimal(weighbridgeAmount);
                exit.SubTotalAmount    = subTotalAmount;
                exit.Vat         = vat;
                exit.TotalAmount = totalAmount;

                exit.ExitComplete = true;

                UnitOfWork.ExitRepository.Update(exit);
                UnitOfWork.Save();

                decimal totalReceivedAmount = Convert.ToDecimal(receivedInventoryAmount) + Convert.ToDecimal(receivedCutAmount)
                                              + Convert.ToDecimal(receivedLoadAmount) + Convert.ToDecimal(receivedVatAmount);

                Payment payment = new Payment()
                {
                    ExitId          = exit.Id,
                    InventoryAmount = Convert.ToDecimal(receivedInventoryAmount),
                    CutAmount       = Convert.ToDecimal(receivedCutAmount),
                    LoadAmount      = Convert.ToDecimal(receivedLoadAmount),
                    VatAmount       = Convert.ToDecimal(receivedVatAmount),
                    TotalAmount     = totalReceivedAmount,
                    IsDeleted       = false,
                    IsActive        = true,
                    CreationDate    = DateTime.Now
                };
                UnitOfWork.PaymentRepository.Insert(payment);
                UnitOfWork.Save();

                if (Convert.ToDecimal(receivedInventoryAmount) > 0)
                {
                    InsertAccounting(receivedInventoryAmount, inventoryAmount, customer, inventoryCustomer, exit.Code.ToString(), "انبار");
                }
                if (Convert.ToDecimal(receivedCutAmount) > 0)
                {
                    InsertAccounting(receivedCutAmount, cutAmount, customer, cutCustomer, exit.Code.ToString(), "برش");
                }
                if (Convert.ToDecimal(receivedLoadAmount) > 0)
                {
                    InsertAccounting(receivedLoadAmount, loadAmount, customer, loadCustomer, exit.Code.ToString(), "بارگذاری");
                }
                if (Convert.ToDecimal(receivedVatAmount) > 0)
                {
                    InsertAccounting(receivedVatAmount, vatAmount, customer, vatCustomer, exit.Code.ToString(), "ارزش افزوده");
                }

                return(Json("true", JsonRequestBehavior.AllowGet));
            }
            catch (Exception e)
            {
                return(Json("false", JsonRequestBehavior.AllowGet));
            }
        }
コード例 #4
0
 public Configuration()
 {
     InitializeComponent();
     manageConfiguration = new ManageConfiguration();
     LoadSettings();
 }