Calculate the price function of each level within the contract - Recommended

zhaozj2021-02-16  43

Demand: The holiday conditions for each level of items within the monthly computing contract are as follows: 1. There are four levels of different levels in the contract, and the price is different; 2. Definition of the price of items at all levels is the price of monthly prices; 3. Every day The price is divided by the price of the items at all levels by 30; 4. Requires the price within the date segment of the input, (the deadline is greater than the start date, such as less than not to consider) 5. If the two days are less than a month, it is less than a month 15 days, the total price is calculated according to the number of days; it is greater than or equal to 15 days. 6. If the two-day difference is greater than one month, the total price is calculated on the month, and the total price is calculated on a monthly basis; 7. More than one month and non-all moon It is less than 15 days, the total price is calculated by the number of days; it is more than 15 days calculations.

Implementation: Evaluates the specified time period the total contract price:

Start Date Published: >
Published deadline: ">
AA price: / month __ 200.00 / day
A level price: / month __ 160.00 / day
B price: / month __ 106.66 ~ / Day
Class Class price: / month __80.00 / day
number of levels of 10 calculations
<% if request ("action") = 1 Then Response.write "Total price =" & diff_month (Requestart ", Request (" Datestart " "Datend"), Request ("AA"), Request ("a"), Request ("B"), Request ("C"), 10, 10, 10, 10) end iffunction diff_month (StartDate, Enddate, Moneyf_aa Moneyf_a, Moneyf_B, Moneyf_c, Amountaa, Amounta, Amountb, Amountc) Different = Datediff ("M", StartDate, Enddate)

'If IF Datediff ("M", StartDate, Enddate) = 0 THEN, STARTDATE, ENDDATE = 0 THEN DIFF_MONTH = (Moneyf_aa / 30) * Amountaa * (Datediff (" D ", startdate, enddate 1) (Moneyf_a / 30) * Amounta * (Datediff (" D ", StartDate, Enddate 1) (Moneyf_B / 30) * AmountB * (Datediff (" D ", StartDate , Enddate) 1) (Moneyf_C / 30) * Amountc * (Datediff ("D", StartDate, Enddate 1) Endiffnessiff ("D", StartDate, Enddate 1> = 15 THEN DIFF_MONTH = Moneyf_aa * Amounta Moneyf_a * Amounta Moneyf_B * Amountb Moneyf_c * Amountc End if Endiff ("M", StartDate, Enddate> 0 and Datediff ("D", Dateadd ("D", Dateadd ("D", DateAdd "M", DIFFERENT, STARTDATE, Enddate) = 0 THEN DIFF_MONTH = (Moneyf_aa * Amountaa Moneyf_a * Amounta Moneyf_B * Amountb Moneyf_C * Amountc) * Different End IF

'If the shape is as 2002-03-15, 2002-05-25 if Datediff ("M", Startdate, Enddate> 0 and Datediff ("D", Dateadd ("M", Different, StartDate), Enddate> 0 Then 'If the phase is greater than one month and <15 days if Datediff ("D", Dateadd ("M", Different, Startdate), Enddate 1 <15 TEN DIFF_MONTH = (Moneyf_aa * AmountA Moneyf_a * Amounta Moneyf_B * Amountb Moneyf_c * Amountc) * Different diff_month = DIFF_MONTH (Moneyf_aa / 30) * Amountaa * (Datediff ("D", Dateadd ("M", Different, Startdate), Enddate 1) (Moneyf_a / 30) * Amounta * (Datediff ("D", Dateadd ("M", Different, Startdate, Enddate 1) (Moneyf_B / 30) * Amountb * (Datediff ("D", DateAdd ("M", Different, StartDate) , Enddate 1) (Moneyf_C / 30) * Amountc * (Datediff ("D", DateAdd ("M", Different, StartDate), EndDate 1)) Endiff 'If the phase is greater than one month and> = 15 days if DateDiff ( "d", DateAdd ( "m", Different, StartDate), EndDate) 1> = 15 then Diff_Month = (MoneyF_AA * AmountAA MoneyF_A * AmountA MoneyF_B * AmountB MoneyF_C * AmountC) * (Different 1) end if Endiff

'If Shaped 2002-03-15, 2002-05-01 if Datediff ("M", Startdate, Enddate> = 1 And Datediff ("D", Dateadd ("M", Different, Startdate), Enddate < 0 THEN DIFFERENT = Datediff ("M", StartDate, Enddate) -1

'If the phase is greater than one month and <15 days if Datediff ("D", Dateadd ("M", Different, Startdate), Enddate) <15 THEN DIFF_MONTH = (Moneyf_aa * AmountA Moneyf_a * Amounta Moneyf_B * Amountb Moneyf_C * Amountc) * DIFFERENT DIFF_MONTH = DIFF_MONTH ((Moneyf_aa / 30) * Amountaa * (Datediff ("D", Dateadd ("M", DIFFERENT, STARTDATE), Enddate 1) (Moneyf_a / 30) * Amounta * (Datediff) ("D", DATEADD ("M", Different, StartDate, Enddate 1) (Moneyf_B / 30) * AmountB * (Datediff ("D", Dateadd ("M", Different, StartDate, Enddate) 1) (Moneyf_C / 30) * Amountc * (Datediff ("D", DateAdd ("M", Different, StartDate, Enddate) 1)) End if 'If the phase is greater than one month and> = 15 days if IF DateDiff ( "d", DateAdd ( "m", Different, StartDate), EndDate)> = 15 then Diff_Month = (MoneyF_AA * AmountAA MoneyF_A * AmountA MoneyF_B * AmountB MoneyF_C * AmountC) * (Different 1) end if End ifend function%>

转载请注明原文地址:https://www.9cbs.com/read-24413.html

New Post(0)