public DataView CostAnalysis(string pGRVNo)
        {
            Receipt receipt = new Receipt(ReceiptID);
               PO PO = receipt.ReceiptInvoice.PO;
               ReceiptInvoice receiptInvoice = receipt.ReceiptInvoice;
               ReceiveDoc receiveDoc = new ReceiveDoc();
               receiveDoc.LoadByReceiptID(ReceiptID);

               Activity activity = new Activity();
               activity.LoadByPrimaryKey(receiveDoc.StoreID);
               JournalEntry UnitCostJournal = new JournalEntry(activity.AccountName, activity.SubAccountName, activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo);
            double GIT = _GrandTotalCost;
               //When insurance is included (_TotalLandedCost-_GrandTotal) is the price effect cauzed by rounding

            double PriceDifference = Math.Round(_PriceDifference - _PriceDifferenceIns,Settings.NoOfDigitsAfterTheDecimalPoint);

            if (receiveDoc.ReturnedStock)
            {
                double stock = Math.Round(GetGrandTotalForSRM(), 2);
                return SRMCostAnalysis(UnitCostJournal, _CommodityType, stock, stock,ReceiptID);
            }
                UnitCostJournal.AddNewEntry("Stock (" + _CommodityType + ")",
                                            Math.Round(_GrandTotalCost + PriceDifference,
                                                       Settings.NoOfDigitsAfterTheDecimalPoint), null);
                if (PriceDifference > 0)
                {
                    UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                }
                else if (PriceDifference < 0)
                {
                    UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                }
                UnitCostJournal.AddNewEntry(
                    "Account Payable (" + GetAccountPayableCorrectNameByAccount(_Supplier) + ")", null,
                    Math.Round(_GrandTotalCost, Settings.NoOfDigitsAfterTheDecimalPoint));

               return UnitCostJournal.DefaultView();
        }
 public DataView SRMCostAnalysis(JournalEntry UnitCostJournal, string CommodityType, double Stock, double CostOfSales,int receiptID)
 {
     UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", CommodityType), Stock, null);
        UnitCostJournal.AddNewEntry("Cost of Good Sold", null, CostOfSales);
        return UnitCostJournal.DefaultView();
 }
 public DataView SRMCostAnalysis(JournalEntry UnitCostJournal,string CommodityType, double Stock, double CostOfSales,int receiptID)
 {
     Receipt receipt = new Receipt();
     string facilityName = receipt.FacilityName(receiptID);
     UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", CommodityType), Stock, null);
     UnitCostJournal.AddNewEntry(String.Format("Account Receivable ({0})",facilityName), null, CostOfSales);
     return UnitCostJournal.DefaultView();
 }
        public DataView CostAnalysis(string pGRVNo)
        {
            Receipt receipt = new Receipt(ReceiptID);
               PO PO = receipt.ReceiptInvoice.PO;
               ReceiptInvoice receiptInvoice = receipt.ReceiptInvoice;
               ReceiveDoc receiveDoc = new ReceiveDoc();
               receiveDoc.LoadByReceiptID(ReceiptID);

               Activity activity = new Activity();
               activity.LoadByPrimaryKey(receiveDoc.StoreID);
               JournalEntry UnitCostJournal = new JournalEntry(activity.AccountName, activity.SubAccountName, activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo);

            double SupplierClaim = Convert.ToDouble(GetSupplierClaim());
            double InsuranceClaim = Convert.ToDouble(GetInsuranceClaim());
            double Provision = Convert.ToDouble(Math.Round(CostBuildUp.Provision, 2));
            double GrandTotal = Math.Round(GetGrandTotal(), 2);
            double PriceDifference = Math.Round(_PriceDifference, 2);
            double Bonus = Convert.ToDouble(Math.Round(_Bonus,2));
            //Request from Mery Formula Provide by Phone
            //Wednesday October 10
            double GIT = Math.Round(GrandTotal + SupplierClaim + InsuranceClaim + _PriceDifference - Provision - Convert.ToDouble(Bonus), 2);

            // trying out Sprout Method to Handle
            if(receiveDoc.ReturnedStock)
            {
                double stock = Math.Round(GetGrandTotalForSRM(),2);
                return SRMCostAnalysis(UnitCostJournal,_CommodityType, stock, stock,ReceiptID);
            }

                if(POType.GetModes(PO.PurchaseType) == POType.STANDARD && CostBuildUp.Invoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE && CostBuildUp.Invoice.InvoiceTypeID  != ReceiptInvoiceType.InvoiceType.CIP)
                {
                    UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", _CommodityType), GrandTotal, null);
                    UnitCostJournal.AddNewEntry("ClaimFromSupplier", SupplierClaim, null);
                    UnitCostJournal.AddNewEntry("ClaimFromInsurance", InsuranceClaim, null);

                    if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else if (PriceDifference > 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }

                    UnitCostJournal.AddNewEntry("GIT", null, GIT);
                    UnitCostJournal.AddNewEntry("Provision", null, Provision);
                    if (Bonus > 0)
                    {
                        UnitCostJournal.AddNewEntry("Other Income", null, Math.Abs(Bonus));
                    }
                }
                else if (activity.IsHealthProgram())
                {
                    UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", _CommodityType), Math.Round(GrandTotal, Settings.NoOfDigitsAfterTheDecimalPoint), null);
                    if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else if (PriceDifference > 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }
                    UnitCostJournal.AddNewEntry(String.Format("Net Asset ({0})", _Supplier), null, Math.Round(GrandTotal - PriceDifference - Bonus, Settings.NoOfDigitsAfterTheDecimalPoint));
                    if (Bonus > 0)
                    {
                        UnitCostJournal.AddNewEntry("Other Income", null, Math.Abs(Bonus));
                    }
                }
                else
                {
                    UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", _CommodityType), Math.Round(GrandTotal, Settings.NoOfDigitsAfterTheDecimalPoint), null);
                    if (PriceDifference > 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }
                    UnitCostJournal.AddNewEntry(String.Format("Account Payable ({0})", _Supplier), null, Math.Round(GIT - Convert.ToDouble(GetTotalDamagedAndShortlanded())-Bonus, Settings.NoOfDigitsAfterTheDecimalPoint));
                    if (Bonus > 0)
                    {
                        UnitCostJournal.AddNewEntry("Other Income", null, Math.Abs(Bonus));
                    }
                }

            return UnitCostJournal.DefaultView();
        }
Beispiel #5
0
 public DataView SRMCostAnalysis(JournalEntry UnitCostJournal, string CommodityType, double Stock, double CostOfSales, int receiptID)
 {
     UnitCostJournal.AddNewEntry(String.Format("Stock ({0})", CommodityType), Stock, null);
     UnitCostJournal.AddNewEntry("Cost of Good Sold", null, CostOfSales);
     return(UnitCostJournal.DefaultView());
 }
        /// <summary>
        /// Costs the analysis.
        /// </summary>
        /// <param name="pGRVNo">The p GRV no.</param>
        /// <returns></returns>
        public DataView CostAnalysis(string pGRVNo)
        {
            GetGrandTotal();
            PO             PO             = ReceiptInvoice.PO;
            ReceiptInvoice receiptInvoice = ReceiptInvoice;
            Activity       Activity       = new Activity();

            Activity.LoadByPrimaryKey(receiptInvoice.ActivityID);
            double       GIT             = TotalLandedCost - Provision;
            JournalEntry UnitCostJournal = new JournalEntry(Activity.AccountName, Activity.SubAccountName, Activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo);
            double       PriceDifference = Math.Round(TotalLandedCost - this.GrandTotal, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);


            if (BLL.Settings.IsCenter)
            {
                if (this.ReceiptInvoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE && this.ReceiptInvoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.CIP)
                {
                    UnitCostJournal.AddNewEntry("Stock", GrandTotal, null);
                    UnitCostJournal.AddNewEntry("ClaimFromSupplier", GetSupplierClaim(), null);
                    UnitCostJournal.AddNewEntry("ClaimFromInsurance", GetInsuranceClaim(), null);

                    if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }

                    UnitCostJournal.AddNewEntry("GIT", null, GIT);
                    UnitCostJournal.AddNewEntry("Provision", null, Provision);
                    UnitCostJournal.AddNewEntry("Other Income", null, 0);
                }
                else
                {
                    UnitCostJournal.AddNewEntry("Stock", GrandTotal, null);
                    if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }
                    UnitCostJournal.AddNewEntry("Account Payable ", null, GIT);
                }
            }
            else
            {
                UnitCostJournal.AddNewEntry("Stock", GrandTotal, null);
                if (PriceDifference < 0)
                {
                    UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                }
                else if (PriceDifference > 0)
                {
                    UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                }
                UnitCostJournal.AddNewEntry("Account Payable ", null, GIT);
            }

            return(UnitCostJournal.DefaultView());
        }
        /// <summary>
        /// Costs the analysis.
        /// </summary>
        /// <param name="pGRVNo">The p GRV no.</param>
        /// <returns></returns>
        public DataView CostAnalysis(string pGRVNo)
        {
            GetGrandTotal();
            PO PO = ReceiptInvoice.PO;
            ReceiptInvoice receiptInvoice = ReceiptInvoice;
            Activity Activity = new Activity();
            Activity.LoadByPrimaryKey(receiptInvoice.ActivityID);
            double GIT = TotalLandedCost - Provision;
            JournalEntry UnitCostJournal = new JournalEntry(Activity.AccountName, Activity.SubAccountName, Activity.Name, PO.Supplier.CompanyName, "", PO.PONumber, pGRVNo, receiptInvoice.STVOrInvoiceNo, receiptInvoice.TransitTransferNo, receiptInvoice.WayBillNo, receiptInvoice.InsurancePolicyNo);
            double PriceDifference = Math.Round(TotalLandedCost - this.GrandTotal, BLL.Settings.NoOfDigitsAfterTheDecimalPoint);

            if (BLL.Settings.IsCenter)
            {
                if (this.ReceiptInvoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.LOCAL_PURCHASE && this.ReceiptInvoice.InvoiceTypeID != ReceiptInvoiceType.InvoiceType.CIP)
                {
                    UnitCostJournal.AddNewEntry("Stock", GrandTotal, null);
                    UnitCostJournal.AddNewEntry("ClaimFromSupplier", GetSupplierClaim(), null);
                    UnitCostJournal.AddNewEntry("ClaimFromInsurance", GetInsuranceClaim(), null);

                    if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }

                    UnitCostJournal.AddNewEntry("GIT", null, GIT);
                    UnitCostJournal.AddNewEntry("Provision", null, Provision);
                    UnitCostJournal.AddNewEntry("Other Income", null, 0);
                }
                else
                {

                    UnitCostJournal.AddNewEntry("Stock", GrandTotal, null);
                    if (PriceDifference < 0)
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                    }
                    else
                    {
                        UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                    }
                    UnitCostJournal.AddNewEntry("Account Payable ", null, GIT);

                }
            }
            else
            {
                UnitCostJournal.AddNewEntry("Stock", GrandTotal, null);
                if (PriceDifference < 0)
                {
                    UnitCostJournal.AddNewEntry("Price Difference", null, Math.Abs(PriceDifference));
                }
                else if (PriceDifference > 0)
                {
                    UnitCostJournal.AddNewEntry("Price Difference", Math.Abs(PriceDifference), null);
                }
                UnitCostJournal.AddNewEntry("Account Payable ", null, GIT);
            }

            return UnitCostJournal.DefaultView();
        }