| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- //
- // SalesInStorageListCell.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/4/23.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "SalesInStorageListCell.h"
- @implementation SalesInStorageListCell
- #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;
- }
- - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
- [super setSelected:selected animated:animated];
-
- }
- #pragma mark 私有函数
- /**
- 跳转到产品明细
- */
- -(void)btnGoDetail{
- __weak typeof(self) weakself=self;
- if ([weakself.inStorageDelegate respondsToSelector:@selector(goInStorageDetail:)]){
- [weakself.inStorageDelegate goInStorageDetail:_index];
- }
- }
- /**
- 去冲正
- */
- -(void)btnGoCorrect{
- __weak typeof(self) weakself=self;
- if ([weakself.inStorageDelegate respondsToSelector:@selector(goCorrect:)]){
- [weakself.inStorageDelegate goCorrect:_index];
- }
- }
- #pragma mark 私有函数
- /**
- 初始化cell UI和数据
- @param inStorageModel <#inStorageModel description#>
- */
- -(void)setSalesInStorageListModel:(OtherInStorageListModel*)inStorageModel{
- _inStorageListModel=inStorageModel;
- if(_inStorageListModel==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 *vInStorageNo = [UIView new];
- vInStorageNo.frame=CGRectMake(0, valuey, Screen_Width, heightRow);
- [self.contentView addSubview:vInStorageNo];
-
- _lblInStorageNo = [UILabel new];
- _lblInStorageNo.frame=CGRectMake(lblx, valuey, Screen_Width- lblx -100, valueheight);
- _lblInStorageNo.textColor = LabelGrayTextColor;
- _lblInStorageNo.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vInStorageNo addSubview:_lblInStorageNo];
- _lblInStorageNo.text = _inStorageListModel.enterNo;
-
- _lblInStorageStatus = [UILabel new];
- _lblInStorageStatus.frame=CGRectMake(Screen_Width-108 ,valuey,100, valueheight);
- _lblInStorageStatus.textAlignment = NSTextAlignmentRight;
- _lblInStorageStatus.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vInStorageNo addSubview:_lblInStorageStatus];
-
- _lblInStorageStatus.textColor = [UIColor blackColor];
- _lblInStorageStatus.text=_inStorageListModel.inventoryEnterTypeName;
- //分割线
- _topSeparatorView= [UIView new];
- _topSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vInStorageNo.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 = _inStorageListModel.customerName;
-
- //电话
- UIView *vSupplier = [UIView new];
- vSupplier.frame=CGRectMake(Screen_Width / 2, CGRectGetMaxY(_topSeparatorView.frame), Screen_Width / 2, heightRow);
- [self.contentView addSubview: vSupplier];
- UILabel *lblSupplierTitle=[UILabel new];
- lblSupplierTitle.frame=CGRectMake(5, lbly, lblwidth, lblheight);
- lblSupplierTitle.text=@"供应商:";
- lblSupplierTitle.textColor = [UIColor blackColor];
- lblSupplierTitle.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSupplier addSubview:lblSupplierTitle];
- _lblSupplier= [UILabel new];
- _lblSupplier.frame=CGRectMake(CGRectGetMaxX(lblSupplierTitle.frame), valuey, Screen_Width/2-lblwidth-5 , valueheight);
- _lblSupplier.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [vSupplier addSubview:_lblSupplier];
- _lblSupplier.text = _inStorageListModel.supplierName;
-
- //客户编码
- UIView *vCustomerCode = [UIView new];
- vCustomerCode.frame=CGRectMake(0, CGRectGetMaxY(vSupplier.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 = _inStorageListModel.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 =_inStorageListModel.organizationName;
- [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 = _inStorageListModel.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 = _inStorageListModel.createUserName;
-
- //账务日期
- 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 =_inStorageListModel.accountDate;
-
-
-
- //分割线
- _middleSeparatorView = [UIView new];
- _middleSeparatorView.frame = CGRectMake(0, CGRectGetMaxY(vAccountDate.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=_inStorageListModel.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];
-
- }
- @end
|