Ejemplo n.º 1
0
        private void calculate_Customer_Amount_When_Receiving_Penalty(BuySellDoc bsd, Person systemPerson, PersonPayingPenalty ppp, decimal totalPaymentAmount)
        {
            //get the maximum commission payable on the freight and sale
            decimal maxPayableAccordingToMaxCommission_Amount = getFreightAndProductCommissionAdded(bsd) * totalPaymentAmount;

            decimal totalPaidOutToCustomerDeliverymanOwner = get_TotalPaidOut_To_Deliveryman_Owner_Customer(ppp);

            ppp.Customer.Person = CustomerBiz.GetPersonForPlayer(bsd.CustomerId);
            ppp.Customer.IsNullThrowException();
            ppp.Customer.Comment = "Customer";
            ppp.Customer.Amount  = totalPaymentAmount - maxPayableAccordingToMaxCommission_Amount;

            if (ppp.Customer.Amount != 0)
            {
                ppp.Customer.Percent = ppp.Customer.Amount / totalPaymentAmount;
            }
        }
Ejemplo n.º 2
0
 private void deliverymanPaysOwner_Penalty(BuySellDoc bsd, Person systemPerson, PersonPayingPenalty ppp, decimal totalPaymentAmount)
 {
     calculate_Deliveryman_Payment(bsd, ppp, totalPaymentAmount);
     calculateCommissions(bsd, systemPerson, ppp, totalPaymentAmount);
     calculate_Owner_Amount_When_Receiving_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
     calculate_ExtraCommission(bsd, systemPerson, ppp, totalPaymentAmount);
 }
Ejemplo n.º 3
0
 private void Owner_Pays_System(BuySellDoc bsd, Person systemPerson, PersonPayingPenalty ppp, decimal totalPaymentAmount)
 {
     calculate_Owner_Payment(bsd, ppp, totalPaymentAmount);
     calculateCommissions(bsd, systemPerson, ppp, totalPaymentAmount);
     calculate_ExtraCommission(bsd, systemPerson, ppp, totalPaymentAmount);
 }
Ejemplo n.º 4
0
 private void customerPaysDeliveryman_Penalty(BuySellDoc bsd, Person systemPerson, PersonPayingPenalty ppp, decimal totalPaymentAmount)
 {
     calculate_Customer_Payment(bsd, ppp, totalPaymentAmount);
     calculateCommissions(bsd, systemPerson, ppp, totalPaymentAmount);
     calculate_Penalty_When_Deliveryman_Is_Receiving(bsd, ppp, totalPaymentAmount);
     calculate_ExtraCommission(bsd, systemPerson, ppp, totalPaymentAmount);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// This is the controller that directs how the payments are made.
        /// </summary>
        /// <param name="bsd"></param>
        /// <param name="systemPerson"></param>
        /// <param name="ppp"></param>
        /// <param name="penalty"></param>
        /// <param name="totalPaymentAmount"></param>
        private void calculateAndDistributePenaltyPayments_Controller(BuySellDoc bsd, Person systemPerson, PersonPayingPenalty ppp, IPenaltyClass penalty, decimal totalPaymentAmount)
        {
            if (totalPaymentAmount == 0)
            {
                return;
            }

            switch (penalty.WhoPaysWhoEnum)
            {
            case WhoPaysWhoENUM.OwnerPaysCustomer:
                ownerPaysCustomer_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
                break;

            case WhoPaysWhoENUM.OwnerPaysDeliveryMan:
                ownerPaysDeliveryMan_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
                break;

            case WhoPaysWhoENUM.OwnerPaysSystem:     //used for optingOutOfSystem
                Owner_Pays_System(bsd, systemPerson, ppp, totalPaymentAmount);
                break;



            case WhoPaysWhoENUM.CustomerPaysOwner:
                customerPaysOwner_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
                break;

            case WhoPaysWhoENUM.CustomerPaysDeliveryman:
                customerPaysDeliveryman_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
                break;

            case WhoPaysWhoENUM.CustomerPaysSystem:
                customer_Pays_System(bsd, systemPerson, ppp, totalPaymentAmount);
                break;

            case WhoPaysWhoENUM.DeliverymanPaysOwner:
                deliverymanPaysOwner_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
                break;

            case WhoPaysWhoENUM.DeliverymanPaysCustomer:
                deliverymanPaysCustomer_Penalty(bsd, systemPerson, ppp, totalPaymentAmount);
                break;


            case WhoPaysWhoENUM.Unknown:
            default:
                throw new Exception("I Dont know who to pay!");
            }
        }