A number of molecular company headquarters procurement system, after the unified purchasing according to different materials, depending on the materials to the molecular company management fee,
Condition one, if material for coal, the management fees fixed is 25 yuan, if it is raw material, the fixed for 15 yuan, if it is the other at 5% of the cost price (management fees) management fee
Condition 2, procurement of coal used for Shanghai company cost rate 3% management fee charging standard, other supplies and other molecular company,
I have done a receiving unit (that is, each branch company name), the name of the material, the cost of the unit price, management fees, management fees of such a data window, and connected to the window, now want to achieve, in the information input, can according to different conditions, the out of the management fees (no manual input),
(receiving unit and the cost of the unit price are manually entered)
I struggled for a few days, always can't find a suitable solution, now is very urgent, and the leadership of the wonder which eldest brother can give me some inspiration, we are so busy to bother very embarrassed! ~
In my statement defines the DOUBLE LR_ LR_ management fee of the structure of management fee rate
STRING LR_ LR_ material receiving unit name
At the back of the statement, I haven't got a clue, the day after tomorrow will pay the sample, it is going crazy!
CodePudding user response:
Acondition, if material for coal, the management fees fixed is 25 yuan, if it is raw material, the fixed for 15 yuan, if it is the other at 5% of the cost price (management fees) management fee
The select LR_=case materials when 'coal' then 25
When 'raw materials' then 15
The else cost unit price * 0.05
End
CodePudding user response:
Acondition, if material for coal, the management fees fixed is 25 yuan, if it is raw material, the fixed for 15 yuan, if it is the other at 5% of the cost price (management fees) management fee
The select LR_=case materials when 'coal' then 25
When 'raw materials' then 15
The else cost unit price * 0.05
End
Condition 2, procurement of coal used for Shanghai company cost rate 3% management fee charging standard, other supplies and other molecular company,
Select LR_ management fee=='coal' case when material and area='Shanghai' then the cost of the unit price * 0.03
='coal' when materials and parts & lt;> 'Shanghai' then 25
When supplies='raw materials' then 15
The else cost unit price * 0.05
End
CodePudding user response:
Write data window itemchanged eventsIn the event you know which line is changed, and can be found out after the change of materials and unit is what
This case is the management fee should be,
Good with setitem after management fees, management fees these two fields will be done
CodePudding user response:
Defined in the dictionary supplies category table and unit management cost calculation formula of theThen judgment in the data window itemchanged events of materials and unit area management fee in the corresponding calculation formula
CodePudding user response:
Write in itemchanged eventsIf LR_ material name="coal" then
If LR_ receiving unit=Shanghai company then
LR_ management fee rate=3%
LR_ fee=cost unit price * LR_ management rate
The else
LR_ fee=25
Rate=LR_ LR_ management fee/cost unit price
End the if
The else
If LR_ material name="raw material" then
LR_ fee=15
Rate=LR_ LR_ management fee/cost unit price
The else
LR_ management fee rate=5%
LR_ fee=cost unit price * LR_ management rate
End the if
end if
CodePudding user response:
upCodePudding user response:
Help you tip, and above all for the positive solution, see you choose what kind of methodCodePudding user response:
Agree with XBQ4724The most simple,
CodePudding user response:
Write a conditional logic? Company policy change writing process much faster than you,In fact this is a design problem, you may wish to consider the following design change,
Here there is a plan for your reference:
1. Material accounting rule definition;
Material code, the unit that receives the code,,,, (the other project is abbreviated),,,, pricing rate (a variety of options: a fixed price, management), fixed price, management fees,,,,
2. When settlement according to the material code and receiving unit for pricing and related parameters;
3. Choose the unit price according to pricing or management fee rate and calculation (only need one condition judgment is OK).
Features: defines settlement rules as a basic policy, can be to deal with in time for the enterprise management environment change, do not need to maintain the program code,
CodePudding user response:
Suggest the building to create a new table, record of a certain company to purchase materials in a calculation, example:Company name of purchasing material calculation tariffs
Shanghai company coal cost ratio 5
Hangzhou company coal fixed costs 25
Hangzhou company's ore cost ratio 3
So when you write a program according to the data of this table to calculate the charge, how do not charge, the same, just change the table calculation and money to go,
CodePudding user response:
Pick up points is king!CodePudding user response:
Agree to the tenth floor, try to set up some more flexibleCodePudding user response:
Create a tableSuggest the building to create a new table, record of a certain company to purchase materials in a calculation, example:
Company name of purchasing material cost ratio tariffs
Shanghai company coal 3% 0
Shanghai company ore 0
15Hangzhou company coal 0 25
Hangzhou company ore 0
15
Write a common stored procedure to calculate the cost:
Formula ratio=cost * + prices
CodePudding user response:
Expenses related to the corresponding relations between do database on the basis of charges in the table, resolute can't set in the program, as if the rates change, you are difficult to maintainCodePudding user response:
Agreed to a new table, distinguish, and use it every time you close the chain,CodePudding user response: