成本乱谈

乱想?

1、  费用列表

一个东西,我在上面一些钱,就是成本。

一个糖果,我在他上面花的所有钱就是成本。

None.gif          public   decimal  成本
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
decimal 费用总和 = 0;
InBlock.gif                
foreach (费用 f in this.费用列表)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    费用总和 
+= f.金额;
ExpandedSubBlockEnd.gif                }

InBlock.gif
InBlock.gif                
return 费用总和;
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

None.gif

2、  部件特性

如果一个东西有几个东西组成,那这个东西的成本就是这个几个子的成本之和。

None.gif          public   decimal  直接成本金额
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return 费用金额总和 + 部件成本金额总和;
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

None.gif
None.gif        
private   decimal  部件成本金额总和
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
decimal m部件成本和 = 0;
InBlock.gif                
foreach (东西 d in this.部件列表)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    m部件成本和 
+= d.直接成本金额;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return m部件成本和;
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

None.gif
None.gif        
private   decimal  费用金额总和
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
decimal m费用总和 = 0;
InBlock.gif                
foreach (费用 f in this.费用列表)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    m费用总和 
+= f.金额;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return m费用总和;
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

3、 分摊特性

我做一双鞋子,我的直接成本出来了,我还想加入其他成本,例如,我把这笔货运出去花了一笔钱。

None.gif          private   decimal  分摊费用金额总和
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
decimal m分摊费用总和 = 0;
InBlock.gif                
foreach (费用 f in this.分摊费用列表)
ExpandedSubBlockStart.gifContractedSubBlock.gif                
dot.gif{
InBlock.gif                    m分摊费用总和 
+= f.金额;
ExpandedSubBlockEnd.gif                }

InBlock.gif                
return m分摊费用总和;
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

None.gif
None.gif        
public   void  重新分摊()
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
decimal 金额 = this.费用金额总和 + this.分摊费用金额总和;
InBlock.gif
InBlock.gif            
//实际代码需考虑 数量 = 0
InBlock.gif
            decimal 分摊单价 = decimal.Round( 金额 / this.数量,6);
InBlock.gif            
decimal temp = 0;
InBlock.gif            
int i = 0;
InBlock.gif
InBlock.gif            
foreach (东西 d in this.部件列表)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                i
++;
InBlock.gif                d.分摊费用列表.Clear();
InBlock.gif
InBlock.gif                
if (i == this.部件列表.Count)
InBlock.gif                    temp 
= 金额;
InBlock.gif                
else
InBlock.gif                    temp 
= d.数量 * 分摊单价;
InBlock.gif
InBlock.gif                
if(temp > 0)
InBlock.gif                    d.分摊费用列表.Add(temp);
InBlock.gif
InBlock.gif                金额 
-= temp;
InBlock.gif
InBlock.gif                东西.重新分摊();
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

None.gif
None.gif        
public   decimal  综合成本金额
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            
get
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return this.分摊费用金额总和 + this.直接成本金额;
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

还没有写完,等会再写 还没有写完,等会再写

转载于:https://www.cnblogs.com/tansm/archive/2005/01/24/96461.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值