| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- //
- // CustomerBalanceCell.m
- // IBOSSmini
- //
- // Created by apple on 2017/5/24.
- // Copyright © 2017年 elongtian. All rights reserved.
- //
- #import "CustomerBalanceCell.h"
- @implementation CustomerBalanceCell
- /**
- awakeFromNib
- */
- - (void)awakeFromNib {
- [super awakeFromNib];
- }
- /**
- 后台代码创建单元cell
-
- @param style <#style description#>
- @param reuseIdentifier <#reuseIdentifier description#>
- @return <#return value description#>
- */
- - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
- self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
- // [self initUI];
- return self;
- }
- /**
- 高度
- @return <#return value description#>
- */
- - (CGFloat)height{
- return CGRectGetMaxY(self.vBottom.frame);
- }
- /**
- 初始化ui
- */
- - (void) initUI: (NSDictionary *)dic{
- if (dic==nil) {
- return;
- }
-
- CGFloat heightLine = 1;
- CGFloat heightRow = 40;
- CGFloat lblx = 20;
- CGFloat lbly = 8;
- CGFloat lblwidth = 80;
- CGFloat lblsubwidth = 38;
- CGFloat lblheight = 25;
- CGFloat valuey = 8;
- CGFloat valueheight = 25;
- NSString *customerid = [[dic objectForKey:@"CustomerID"] stringValue];
-
- //title==================
- UIView *vTitle = [UIView new];
- vTitle.frame=CGRectMake(0, 0, Screen_Width, 10);
- vTitle.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:vTitle];
-
- //客户名称==================
- UIView *vcustomerName = [UIView new];
- vcustomerName.frame=CGRectMake(0, CGRectGetMaxY(vTitle.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vcustomerName];
- // UILabel *lblName=[UILabel new];
- // lblName.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- // lblName.text=@"客户名称:";
- // lblName.textColor = [UIColor blackColor];
- // lblName.font = [UIFont systemFontOfSize: TitleFontOfSize];
- // [vcustomerName addSubview:lblName];
-
- _createTime = [UILabel new];
- _createTime.frame=CGRectMake(Screen_Width - 95 - lblx, valuey, 95, valueheight);
- _createTime.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _createTime.textAlignment = NSTextAlignmentRight;
- //[vcustomerName addSubview:_createTime];
-
- _lblValueCustomerName = [UILabel new];
- _lblValueCustomerName.frame=CGRectMake(lblx, valuey, Screen_Width - 2*lblx , valueheight);
- _lblValueCustomerName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vcustomerName addSubview:_lblValueCustomerName];
- _lblValueCustomerName.text=[dic objectForKey:@"CustomerName"];
- if (customerid==nil || customerid.length==0) {
- _lblValueCustomerName.textColor = [UIColor redColor];
- }else{
- _lblValueCustomerName.textColor = [UIColor blackColor];
- }
-
- //分割线
- UIView *viewBackgroud = [UIView new];
- viewBackgroud.frame = CGRectMake(0, CGRectGetMaxY(vcustomerName.frame), Screen_Width, heightLine);
- viewBackgroud.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:viewBackgroud];
-
- UIView *viewTemp;
-
- if (customerid==nil || customerid.length==0) {
- viewTemp = viewBackgroud;
- }else{
- //业务部门 业务员==================
- UIView *vOrgStaff = [UIView new];
- vOrgStaff.frame=CGRectMake(0, CGRectGetMaxY(viewBackgroud.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vOrgStaff];
-
- UIView *vOrg = [UIView new];
- vOrg.frame=CGRectMake(0, 0, Screen_Width/2, heightRow);
- [vOrgStaff addSubview:vOrg];
-
- UILabel *lblOrg=[UILabel new];
- lblOrg.frame=CGRectMake(lblx, lbly, lblwidth/2, lblheight);
- lblOrg.text=@"部门:";
- lblOrg.textColor = LabelGrayTextColor;
- lblOrg.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOrg addSubview:lblOrg];
- _lblValueOrg = [UILabel new];
- _lblValueOrg.frame=CGRectMake(CGRectGetMaxX(lblOrg.frame), valuey, Screen_Width/2 - CGRectGetMaxX(lblOrg.frame), valueheight);
- _lblValueOrg.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
-
- [vOrg addSubview:_lblValueOrg];
-
- UIView *vStaff = [UIView new];
- vStaff.frame=CGRectMake(Screen_Width/2, 0, Screen_Width/2, heightRow);
- [vOrgStaff addSubview:vStaff];
-
- UILabel *lblStaff=[UILabel new];
- lblStaff.frame=CGRectMake(5, lbly, 55, lblheight);
- lblStaff.text=@"业务员:";
- lblStaff.textColor = LabelGrayTextColor;
- lblStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vStaff addSubview:lblStaff];
- _lblValueStaff = [UILabel new];
- _lblValueStaff.frame=CGRectMake(55, valuey, Screen_Width/2 - 55 - 10, valueheight);
- _lblValueStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vStaff addSubview:_lblValueStaff];
- _lblValueStaff.text=[dic objectForKey:@"SalesManName"];
- _lblValueOrg.text=[dic objectForKey:@"OrganizationName"];
- viewTemp = vOrgStaff;
- }
-
- float receivableValue = [[dic objectForKey:@"AccountReceivable"]floatValue];
- float depositValue = [[dic objectForKey:@"DepositReceived"]floatValue];
- float earnestValue = [[dic objectForKey:@"Earnest"]floatValue];
-
- //定金 应收款 预收款==================
- UIView *vReceivableAndDepositAndEarnest = [UIView new];
- vReceivableAndDepositAndEarnest.frame=CGRectMake(0, CGRectGetMaxY(viewTemp.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vReceivableAndDepositAndEarnest];
-
- UIView *vEarnest = [UIView new];
- vEarnest.frame=CGRectMake(0, 0, Screen_Width/3, heightRow);
- [vReceivableAndDepositAndEarnest addSubview:vEarnest];
-
- UILabel *lblEarnest=[UILabel new];
- lblEarnest.frame=CGRectMake(lblx, lbly, lblsubwidth, lblheight);
- lblEarnest.text=@"定金:";
- lblEarnest.textColor = [UIColor blackColor];
- lblEarnest.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vEarnest addSubview:lblEarnest];
- _lblValueEarnest = [UILabel new];
- _lblValueEarnest.frame=CGRectMake(CGRectGetMaxX(lblEarnest.frame), valuey, Screen_Width/3 -lblsubwidth - 20 , valueheight);
- _lblValueEarnest.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vEarnest addSubview:_lblValueEarnest];
-
- UIView *vReceivable = [UIView new];
- vReceivable.frame=CGRectMake(Screen_Width/3, 0, Screen_Width/3, heightRow);
- [vReceivableAndDepositAndEarnest addSubview:vReceivable];
-
- UILabel *lblReceivable=[UILabel new];
- lblReceivable.frame=CGRectMake(5, lbly, 55, lblheight);
- lblReceivable.text=@"应收款:";
- lblReceivable.textColor = [UIColor blackColor];
- lblReceivable.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vReceivable addSubview:lblReceivable];
- _lblValueReceivable = [UILabel new];
- _lblValueReceivable.frame=CGRectMake(55, valuey, Screen_Width/3 - 60, valueheight);
- _lblValueReceivable.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vReceivable addSubview:_lblValueReceivable];
-
- UIView *vDeposit = [UIView new];
- vDeposit.frame=CGRectMake(Screen_Width*2/3, 0, Screen_Width/3, heightRow);
- [vReceivableAndDepositAndEarnest addSubview:vDeposit];
-
- UILabel *lblDeposit=[UILabel new];
- lblDeposit.frame=CGRectMake(5, lbly, 55, lblheight);
- lblDeposit.text=@"预收款:";
- lblDeposit.textColor = [UIColor blackColor];
- lblDeposit.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vDeposit addSubview:lblDeposit];
- _lblValueDeposit = [UILabel new];
- _lblValueDeposit.frame=CGRectMake(55, valuey, Screen_Width/3 - 65, valueheight);
- _lblValueDeposit.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [vDeposit addSubview:_lblValueDeposit];
-
- _lblValueReceivable.text = [NSString stringWithFormat:@"¥%.2f",receivableValue ];
- _lblValueDeposit.text = [NSString stringWithFormat:@"¥%.2f", depositValue ];
- _lblValueEarnest.text = [NSString stringWithFormat:@"¥%.2f", earnestValue ];
-
- self.vBottom = [UIView new];
- self.vBottom.frame=CGRectMake(0, CGRectGetMaxY(vReceivableAndDepositAndEarnest.frame), Screen_Width, heightRow);
- [self.contentView addSubview:self.vBottom];
- //
- // UILabel *lblreceivableAndDepositAndEarnest =[UILabel new];
- // lblreceivableAndDepositAndEarnest.frame=CGRectMake(lblx, lbly, lblwidth*2, lblheight);
- // lblreceivableAndDepositAndEarnest.text=@"应收款-预收款-定金:";
- // lblreceivableAndDepositAndEarnest.textColor = [UIColor blackColor];
- // lblreceivableAndDepositAndEarnest.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- // [vBottom addSubview:lblreceivableAndDepositAndEarnest];
-
- _lblReceivableAndDepositAndEarnest = [UILabel new];
- _lblReceivableAndDepositAndEarnest.frame=CGRectMake(lblx, valuey, Screen_Width -2* lblx , valueheight);
- // _lblreceivableAndDepositAndEarnest = NSTextAlignmentRight;
- _lblReceivableAndDepositAndEarnest.font = [UIFont systemFontOfSize: SubLabelAndTextFontOfSize];
- [self.vBottom addSubview:_lblReceivableAndDepositAndEarnest];
- NSString *str = [NSString stringWithFormat:@"应收款-预收款-定金:¥%.2f",receivableValue-depositValue-earnestValue];
- _lblReceivableAndDepositAndEarnest.text = str;
- //
- // NSString *str = [NSString stringWithFormat:@"(收入:¥%@;成本:¥%@;毛利:¥%@)",m.inventoryQuantity,m.price];
-
- }
- @end
|