| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- //
- // SalesOutStorageListCell.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/10.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "SalesOutStorageListCell.h"
- @implementation SalesOutStorageListCell
- #pragma mark 公共函数
- /**
- 加载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];
-
- return self;
- }
- #pragma mark 私有函数
- /**
- 初始化cell UI和数据
- @param salesOutStorageModel <#salesOutStorageModel description#>
- */
- - (void)setSalesOutStorageModel:(SalesOutStorageListModel *)salesOutStorageModel{
- _outStorageModel=salesOutStorageModel;
- if(_outStorageModel==nil){
- return;
- }
- CGFloat heightLine = 1;
- CGFloat heightRow = 40;
- CGFloat lblx = 20;
- CGFloat lbly = 8;
- CGFloat lblwidth = 70;
- CGFloat lblheight = 25;
- CGFloat btnwidth = 50;
- CGFloat valuey = 8;
- CGFloat valueheight = 25;
-
- UIView *vOutStorageNo = [UIView new];
- vOutStorageNo.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
- [self.contentView addSubview:vOutStorageNo];
-
- _lblOutStorageNo = [UILabel new];
- _lblOutStorageNo.frame=CGRectMake(lblx, valuey, Screen_Width- lblx - 100, valueheight);
- _lblOutStorageNo.textColor = LabelGrayTextColor;
- _lblOutStorageNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOutStorageNo addSubview:_lblOutStorageNo];
- _lblOutStorageNo.text = _outStorageModel.outStorageNo;
-
- _lblOutStorageStatus = [UILabel new];
- _lblOutStorageStatus.frame=CGRectMake(Screen_Width-108 ,valuey,100, valueheight);
- _lblOutStorageStatus.textAlignment = NSTextAlignmentRight;
- _lblOutStorageStatus.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vOutStorageNo addSubview:_lblOutStorageStatus];
-
- _lblOutStorageStatus.textColor = [UIColor blackColor];
- _lblOutStorageStatus.text=_outStorageModel.outStorageTypeName;
-
- //分割线
- _topSeparatorView= [UIView new];
- _topSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vOutStorageNo.frame), Screen_Width, heightLine);
-
- [self.contentView addSubview:_topSeparatorView];
- UIButton *btnLine = [UIButton buttonWithType:UIButtonTypeCustom];
- [btnLine setBackgroundImage:[UIImage imageNamed:@"dash"] forState:UIControlStateNormal];
- btnLine.frame = CGRectMake(0 ,0 , Screen_Width, heightLine);
- [_topSeparatorView addSubview:btnLine];
-
- //客户名称
- UIView *vCustomerName = [UIView new];
- vCustomerName.frame=CGRectMake(0, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vCustomerName];
- UILabel *lblCustomerNameTitle=[UILabel new];
- lblCustomerNameTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblCustomerNameTitle.text=@"客户名称:";
- lblCustomerNameTitle.textColor = [UIColor blackColor];
- lblCustomerNameTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerName addSubview:lblCustomerNameTitle];
- _lblCustomerName = [UILabel new];
- _lblCustomerName.frame=CGRectMake(CGRectGetMaxX(lblCustomerNameTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblCustomerNameTitle.frame), valueheight);
- _lblCustomerName.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerName addSubview:_lblCustomerName];
- _lblCustomerName.text = _outStorageModel.customerName;
-
- //电话
- UIView *vCustomerTelephone = [UIView new];
- vCustomerTelephone.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vCustomerTelephone];
- UILabel *lblCustomerTelephoneTitle=[UILabel new];
- lblCustomerTelephoneTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblCustomerTelephoneTitle.text=@"客户电话:";
- lblCustomerTelephoneTitle.textColor = [UIColor blackColor];
- lblCustomerTelephoneTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerTelephone addSubview:lblCustomerTelephoneTitle];
- _lblCustomerTelephone= [UILabel new];
- _lblCustomerTelephone.frame=CGRectMake(CGRectGetMaxX(lblCustomerTelephoneTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblCustomerTelephone.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerTelephone addSubview:_lblCustomerTelephone];
- _lblCustomerTelephone.text = _outStorageModel.contactTelephone;
-
-
- //客户编码
- UIView *vCustomerCode = [UIView new];
- vCustomerCode.frame=CGRectMake(0, CGRectGetMaxY(vCustomerName.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vCustomerCode];
- UILabel *lblCustomerCodeTitle=[UILabel new];
- lblCustomerCodeTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblCustomerCodeTitle.text=@"客户编码:";
- lblCustomerCodeTitle.textColor = [UIColor blackColor];
- lblCustomerCodeTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerCode addSubview:lblCustomerCodeTitle];
- _lblCustomerCode = [UILabel new];
- _lblCustomerCode.frame=CGRectMake(CGRectGetMaxX(lblCustomerCodeTitle.frame), valuey, Screen_Width-CGRectGetMaxX(lblCustomerCodeTitle.frame)-10, valueheight);
- _lblCustomerCode.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerCode addSubview:_lblCustomerCode];
- _lblCustomerCode.text = _outStorageModel.customerCode;
-
- //业务部门
- UIView *vDepartment = [UIView new];
- vDepartment.frame=CGRectMake(0, CGRectGetMaxY(vCustomerCode.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vDepartment];
-
- UILabel *lblDepartmentTitle=[UILabel new];
- lblDepartmentTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblDepartmentTitle.text=@"业务部门:";
- lblDepartmentTitle.textColor = [UIColor blackColor];
- lblDepartmentTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vDepartment addSubview:lblDepartmentTitle];
-
- _lblBusinessDepartment= [UILabel new];
- _lblBusinessDepartment.frame=CGRectMake(CGRectGetMaxX(lblDepartmentTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblDepartmentTitle.frame), valueheight);
- _lblBusinessDepartment.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vDepartment addSubview:_lblBusinessDepartment];
- _lblBusinessDepartment.text =_outStorageModel.businessDepartmentName;
- [vDepartment addSubview:_lblBusinessDepartment];
- //业务员
- UIView *vStaffName = [UIView new];
- vStaffName.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vCustomerCode.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vStaffName];
-
- UILabel *lblStaffNameTitle=[UILabel new];
- lblStaffNameTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblStaffNameTitle.text=@"业 务 员:";
- lblStaffNameTitle.textColor = [UIColor blackColor];
- lblStaffNameTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vStaffName addSubview:lblStaffNameTitle];
- _lblStaff= [UILabel new];
- _lblStaff.frame=CGRectMake(CGRectGetMaxX(lblStaffNameTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblStaff.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vStaffName addSubview:_lblStaff];
- _lblStaff.text = _outStorageModel.staffName;
- //创建人
- UIView *vCreator = [UIView new];
- vCreator.frame=CGRectMake(0, CGRectGetMaxY(vDepartment.frame), Screen_Width/2, heightRow);
- [self.contentView addSubview:vCreator];
-
- UILabel *lblCreatorTitle=[UILabel new];
- lblCreatorTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblCreatorTitle.text=@"创 建 人:";
- lblCreatorTitle.textColor = [UIColor blackColor];
- lblCreatorTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCreator addSubview:lblCreatorTitle];
- _lblCreater = [UILabel new];
- _lblCreater.frame=CGRectMake(CGRectGetMaxX(lblCreatorTitle.frame), valuey, Screen_Width/2 -CGRectGetMaxX(lblCreatorTitle.frame), valueheight);
- _lblCreater.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCreator addSubview:_lblCreater];
- _lblCreater.text = _outStorageModel.creater;
-
- //账务日期
- UIView *vAccountDate = [UIView new];
- vAccountDate.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(vDepartment.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vAccountDate];
-
- UILabel *lblAccountDateTitle=[UILabel new];
- lblAccountDateTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblAccountDateTitle.text=@"账务日期:";
- lblAccountDateTitle.textColor = [UIColor blackColor];
- lblAccountDateTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vAccountDate addSubview:lblAccountDateTitle];
- _lblAccountDate= [UILabel new];
- _lblAccountDate.frame=CGRectMake(CGRectGetMaxX(lblAccountDateTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblAccountDate.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vAccountDate addSubview:_lblAccountDate];
- _lblAccountDate.text =_outStorageModel.accountDate;
-
- //客户地址
- UIView *vCustomerAddress = [UIView new];
- vCustomerAddress.frame=CGRectMake(0, CGRectGetMaxY(vCreator.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vCustomerAddress];
-
- UILabel *lblCustomerAddressTitle=[UILabel new];
- lblCustomerAddressTitle.frame=CGRectMake(lblx, lbly, lblwidth, lblheight);
- lblCustomerAddressTitle.text=@"客户地址:";
- lblCustomerAddressTitle.textColor = [UIColor blackColor];
- lblCustomerAddressTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerAddress addSubview:lblCustomerAddressTitle];
- _lblCustomerAddress = [UILabel new];
- _lblCustomerAddress.frame=CGRectMake(CGRectGetMaxX(lblCustomerAddressTitle.frame), valuey, Screen_Width -CGRectGetMaxX(lblCustomerAddressTitle.frame), valueheight);
- _lblCustomerAddress.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vCustomerAddress addSubview:_lblCustomerAddress];
- _lblCustomerAddress.text =_outStorageModel.customerAddress;
-
- //分割线
- _middleSeparatorView = [UIView new];
- _middleSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vCustomerAddress.frame), Screen_Width, heightLine);
- _middleSeparatorView.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:_middleSeparatorView];
-
- //客户地址
- UIView *vGoodsQuantity = [UIView new];
- vGoodsQuantity.frame=CGRectMake(0, CGRectGetMaxY(_middleSeparatorView.frame), Screen_Width, heightRow);
- [self.contentView addSubview:vGoodsQuantity];
-
- _btnCorrect = [UIButton buttonWithType:UIButtonTypeCustom];
- [_btnCorrect setTitle:@"冲正" forState:UIControlStateNormal];
- [_btnCorrect setBackgroundColor:[UIColor whiteColor]];
- _btnCorrect.layer.cornerRadius = 10;
- [_btnCorrect setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
- _btnCorrect.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
- _btnCorrect.layer.borderWidth = 0.5f;//设置边框颜色
- _btnCorrect.layer.borderColor = [UIColor redColor].CGColor;
- _btnCorrect.frame = CGRectMake(Screen_Width-btnwidth-8 ,lbly+8 , btnwidth, valueheight);
- [_btnCorrect addTarget:self action:@selector(btnGoCorrect) forControlEvents:UIControlEventTouchUpInside];
- [vGoodsQuantity addSubview:_btnCorrect];
- _btnGoodsDetail=[UIButton buttonWithType:UIButtonTypeCustom];
- [_btnGoodsDetail setTitle:@"商品详细" forState:UIControlStateNormal];
- [_btnGoodsDetail setBackgroundColor:[UIColor whiteColor]];
- _btnGoodsDetail.layer.cornerRadius = 10;
- _btnGoodsDetail.titleLabel.font= [UIFont systemFontOfSize:ButtonFontOfSize];
- _btnGoodsDetail.layer.borderWidth = 0.5f;//设置边框颜色
- _btnGoodsDetail.layer.borderColor = [UIColor blackColor].CGColor;
- [_btnGoodsDetail setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- _btnGoodsDetail.frame = CGRectMake(Screen_Width-btnwidth-70-8*2 ,lbly+8 , 70, valueheight);
- [_btnGoodsDetail addTarget:self action:@selector(btnGoDetail) forControlEvents:UIControlEventTouchUpInside];
- [vGoodsQuantity addSubview:_btnGoodsDetail];
-
- NSInteger status=_outStorageModel.invoiceStatusId;
- switch (status) {
- case 3:
- _btnGoodsDetail.layer.borderColor = [UIColor blackColor].CGColor;
- [_btnGoodsDetail setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- [_btnGoodsDetail setEnabled:YES];
- _btnCorrect.layer.borderColor = [UIColor redColor].CGColor;
- [_btnCorrect setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
- [_btnCorrect setEnabled:YES];
- break;
-
- case 10:
- _btnGoodsDetail.layer.borderColor = [UIColor blackColor].CGColor;
- [_btnGoodsDetail setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
- [_btnGoodsDetail setEnabled:YES];
- _btnCorrect.layer.borderColor = [UIColor lightGrayColor].CGColor;
- [_btnCorrect setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
- [_btnCorrect setEnabled:NO];
- break;
-
- }
-
- _bottomSeparatorView = [UIView new];
- _bottomSeparatorView.frame=CGRectMake(0, CGRectGetMaxY(vGoodsQuantity.frame)+15, Screen_Width, 10);
- _bottomSeparatorView.backgroundColor = LineBackgroundColor;
- [self.contentView addSubview:_bottomSeparatorView];
-
-
- }
- /**
- 去冲正
- */
- -(void)btnGoCorrect{
- __weak typeof(self) weakself=self;
- if ([weakself.salesOutStorageDelegate respondsToSelector:@selector(goCorrect:)]){
- [weakself.salesOutStorageDelegate goCorrect:_outStorageModel];
- }
- }
- /**
- 跳转到销售出库明细
- */
- -(void)btnGoDetail{
- __weak typeof(self) weakself=self;
- if ([weakself.salesOutStorageDelegate respondsToSelector:@selector(goDetail:)]){
- [weakself.salesOutStorageDelegate goDetail:_outStorageModel];
- }
- }
- @end
|