Commit 655c6f92 authored by 陈俊俊's avatar 陈俊俊

小数位数

parent 9c761228
......@@ -64,4 +64,4 @@ SPEC CHECKSUMS:
SDWebImage: 1d2b1a1efda1ade1b00b6f8498865f8ddedc8a84
SSKeychain: 3f42991739c6c60a9cf1bbd4dff6c0d3694bcf3d
COCOAPODS: 0.39.0
COCOAPODS: 0.38.2
This diff is collapsed.
......@@ -98,7 +98,7 @@ static NSString *ICRDataBasePath = @"";
[_m_dbQueue inDatabase:^(FMDatabase *db) {
NSArray *tableNameArr =
@[ [Product class],[User class],[Survey class],[Vendor class],[Warehouse class],[GXFProductUnit class],[Accounttitle class]];
@[ [Product class],[User class],[Survey class],[Vendor class],[Warehouse class],[GXFProductUnit class],[Accounttitle class],[ICRAnnouncement class]];
NSMutableArray *sqlBatch = [NSMutableArray array];
NSString *sql = nil;
......
......@@ -13,6 +13,9 @@
#define KNOTIFICATION_getSelectPurchaseProduct @"KNOTIFICATION_getSelectPurchaseProduct"
#define KNOTIFICATION_ChoseTransportPurchase @"KNOTIFICATION_ChoseTransportPurchase"//选择采购单
#define KNOTIFICATION_ChoseTransportProduct @"KNOTIFICATION_ChoseTransportProduct"//选择发运单
#define KNOTIFICATION_ChoseTransferProduct @"KNOTIFICATION_ChoseTransferProduct"//选择转运单
#define KNOTIFICATION_EditReceiveProduct @"KNOTIFICATION_EditReceiveProduct"
......
......@@ -74,8 +74,6 @@ static ICRUserUtil *sharedInstance = nil;
- (BOOL)saveArchive {
BOOL result;
// get archive path to storage
NSString *filePath = [[self class] archivePath];
result = [NSKeyedArchiver archiveRootObject:self toFile:filePath];
......
......@@ -8,7 +8,7 @@
#import "BusinessViewController.h"
#import "ICRAnnouncementViewController.h"
#import "NewSurveyViewController.h"
#import "SurveyViewController.h"
......@@ -123,8 +123,8 @@
switch (imageView.tag) {
case kFunctionNotice://公告
{
// ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
// [self PushViewController:aVC animated:YES];
ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
[self PushViewController:aVC animated:YES];
}
break;
case kFunctionNewSurvey://新建行情
......
......@@ -15,6 +15,7 @@
#import "ICRFunctionBaseView.h"
#import "ICRFunctionEntity.h"
#import "ICRAnnouncementViewController.h"
#import "NewSurveyViewController.h"
#import "SurveyViewController.h"
......@@ -26,22 +27,17 @@
#import "PurchaseNoticeViewController.h"
#import "GXFNewProcessViewController.h"
#import "GXFFunctionsViewController.h"
#import "GXFDisplayFunction.h"
#import "GXFFunction.h"
#import "GXFNoticeFunctionTableViewCell.h"
#import "GXFFunctionCollectionViewCell.h"
#import "GXFListProcessViewController.h"
#import "GXFFunctionDB.h"
#define ICRFUNCTION_IMG_TOP_PADDING (25)
#define ICRFUNCTION_IMG_WIDTH (65)
#define ICRFUNCTION_LABEL_HEIGHT (15)
#define ICRFUNCTION_INNER_GAP (5)
#define RIGHT_LINE_WIDTH (0.5)
@interface ICRHomeViewController ()
<UITableViewDataSource,UITableViewDelegate,UICollectionViewDataSource,UICollectionViewDelegate,ICRFunctionBaseViewDelegate>//,UICollectionViewDelegateFlowLayout>
......@@ -226,8 +222,8 @@ static NSString *collectionCellID = @"collectionCell";
switch (imageView.tag) {
case kFunctionNotice://公告
{
// ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
// [self PushViewController:aVC animated:YES];
ICRAnnouncementViewController *aVC = [[ICRAnnouncementViewController alloc] init];
[self PushViewController:aVC animated:YES];
}
break;
case kFunctionNewSurvey://新建行情
......
......@@ -161,7 +161,7 @@ typedef enum : NSUInteger {
for (PurchaseBillProduct *billProduct in purchaseProduct) {
totalPrice += [billProduct.total floatValue];
}
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.4f",totalPrice + otherPrice];
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice];
_purchaseView.chargePurchase = [NSNumber numberWithFloat:otherPrice];
_purchaseView.total = [NSNumber numberWithFloat:totalPrice+otherPrice];
}
......@@ -370,10 +370,10 @@ typedef enum : NSUInteger {
shopDetail.packageSpecification = [billProduct.qpc stringValue];
shopDetail.packageUnit = billProduct.unit;
shopDetail.packageQuantity = [billProduct.qty stringValue];
shopDetail.packageUnitPrice = [billProduct.price stringValue];
shopDetail.packageUnitPrice = billProduct.price;
shopDetail.foundationQuantity= [billProduct.baseQty stringValue];
shopDetail.foundationUnitPrice= [billProduct.basePrice stringValue];
shopDetail.totalMoney= [billProduct.total stringValue];
shopDetail.foundationUnitPrice= billProduct.basePrice;
shopDetail.totalMoney= billProduct.total;
shopDetail.remark = billProduct.remark;
shopDetail.packageQpcStr = billProduct.qpcStr;
shopDetail.packageQpcUnit = billProduct.baseUnit;
......
......@@ -145,7 +145,7 @@
{
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = billProduct.product_name;
self.priceLabel.text = [NSString stringWithFormat:@"%@元",[billProduct.basePrice stringValue]];
self.priceLabel.text = [NSString stringWithFormat:@"%.2f元",[billProduct.basePrice floatValue]];
self.countLabel.text = [NSString stringWithFormat:@"%@%@",[billProduct.qty stringValue],billProduct.unit];
self.shippedQtyLabel.text = [NSString stringWithFormat:@"%@%@",billProduct.shippedBaseQty ? [billProduct.shippedBaseQty stringValue]:@"0",billProduct.unit];
......@@ -153,9 +153,9 @@
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[billProduct.qpc stringValue],billProduct.baseUnit];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",[billProduct.qty stringValue],billProduct.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",[billProduct.baseQty stringValue],billProduct.baseUnit];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",[billProduct.price stringValue]];
self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%@元",[billProduct.basePrice stringValue]];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",[billProduct.total stringValue]];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%.2f元",[billProduct.price floatValue]];
self.showBasePriceLabel.text = [NSString stringWithFormat:@"基础单价:%.2f元",[billProduct.basePrice floatValue]];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%.2f元",[billProduct.total floatValue]];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",billProduct.remark ? billProduct.remark :@"无" ];
[self isShowShippingQty:billProduct];
}
......
......@@ -21,9 +21,9 @@
@property (nonatomic,strong)NSString *packageQuantity;//包装数量
@property (nonatomic,strong)NSString *packageUnit;//包装单位
@property (nonatomic,strong)NSString *foundationQuantity;//基础数量
@property (nonatomic,strong)NSString *foundationUnitPrice;//基础单价
@property (nonatomic,strong)NSString *packageUnitPrice;//包装单价
@property (nonatomic,strong)NSString *totalMoney;//总金额
@property (nonatomic,strong)NSNumber *foundationUnitPrice;//基础单价
@property (nonatomic,strong)NSNumber *packageUnitPrice;//包装单价
@property (nonatomic,strong)NSNumber *totalMoney;//总金额
@property (nonatomic,strong)NSString *remark;//备注
@property (nonatomic,assign)BOOL IsDeleted;//是否删除
@property (nonatomic,assign)BOOL IsXiuGai;//是否删除
......
......@@ -52,6 +52,12 @@ typedef enum : NSUInteger {
@property (nonatomic,strong)NSString *productMeasureUnit;//默认规格单位
@property (nonatomic,strong)NSString *packageQpcStr; //规格描述
@property (nonatomic,strong)NSString *packageUintStr; //包装单位
@property (nonatomic,strong)NSNumber *packPrice;//包装单价
@property (nonatomic,strong)NSNumber *basePrice;//基础单价
@property (nonatomic,strong)NSNumber *totalPrice;//总金额
@property (nonatomic,strong)NSMutableArray *selectProducts;
@property (nonatomic,strong)NSString *selectUnit;
......@@ -125,18 +131,22 @@ typedef enum : NSUInteger {
foundationQuantity.text=self.shopDetail.foundationQuantity;
//基础单价
if ([self.shopDetail.foundationUnitPrice floatValue] > 0) {
foundationUnitPrice.text=self.shopDetail.foundationUnitPrice;
foundationUnitPrice.text= [NSString stringWithFormat:@"%.2f",[self.shopDetail.foundationUnitPrice floatValue]];
}
self.basePrice = self.shopDetail.foundationUnitPrice;
//包装单价
if ([self.shopDetail.packageUnitPrice floatValue] > 0) {
packageUnitPrice.text=self.shopDetail.packageUnitPrice;
packageUnitPrice.text=[NSString stringWithFormat:@"%.2f",[self.shopDetail.packageUnitPrice floatValue]];
}
self.packPrice = self.shopDetail.packageUnitPrice;
//总金额
if ([self.shopDetail.totalMoney floatValue] <= 0) {
totalMoney.text=@"0.0000";
}else{
totalMoney.text=self.shopDetail.totalMoney;
totalMoney.text=[NSString stringWithFormat:@"%.2f",[self.shopDetail.totalMoney floatValue]];
}
self.totalPrice = self.shopDetail.totalMoney;
//备注
remark.text=self.shopDetail.remark;
......@@ -226,12 +236,12 @@ typedef enum : NSUInteger {
self.shopDetail.packageUnit = self.packageUintStr;
self.shopDetail.packageQuantity = packageQuantity.text;
self.shopDetail.packageUnitPrice = packageUnitPrice.text;
self.shopDetail.packageUnitPrice = self.packPrice;
self.shopDetail.foundationQuantity = foundationQuantity.text;
self.shopDetail.foundationUnitPrice = foundationUnitPrice.text;
self.shopDetail.foundationUnitPrice = self.basePrice;
self.shopDetail.totalMoney = totalMoney.text;
self.shopDetail.totalMoney = self.totalPrice;
self.shopDetail.remark = remark.text;
if (self.productNameStr.length == 0 ) {
......@@ -458,13 +468,16 @@ typedef enum : NSUInteger {
}
}else if(textField == foundationUnitPrice){
//基础单价
self.basePrice = [NSNumber numberWithFloat:foundationUnitPrice.text.floatValue];
[self setPacktAndTotalPrice];
//如果基础数量和包装数量有的话计算出包装单价和和总价
}else if (textField == packageUnitPrice){
//包装单价
self.packPrice = [NSNumber numberWithFloat:packageUnitPrice.text.floatValue];
[self setUnitAndTotalPrice];
}else if(textField == totalMoney){
//总金额
self.totalPrice = [NSNumber numberWithFloat:totalMoney.text.floatValue];
[self setUnitAndPackPrice];
}
}
......@@ -475,27 +488,30 @@ typedef enum : NSUInteger {
[self setUnitAndTotalPrice];
}
- (void)setPacktAndTotalPrice{
if (foundationUnitPrice.text.length > 0) {
if (self.basePrice && foundationUnitPrice.text.length > 0) {
if (foundationQuantity.text.length > 0) {
float totalPrice = [foundationUnitPrice.text floatValue] * [foundationQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.4f",totalPrice];
float totalPrice = [self.basePrice floatValue] * [foundationQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.2f",totalPrice];
self.totalPrice = [NSNumber numberWithFloat:totalPrice];
if (packageQuantity.text.length > 0 && [packageQuantity.text floatValue] > 0) {
float packagePrice = totalPrice / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
packageUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.packPrice = [NSNumber numberWithFloat:packagePrice];
}
}
}
}
//输入包装单价(包装数量和基础数量)计算基础单价和总金额
- (void)setUnitAndTotalPrice{
if (packageUnitPrice.text.length > 0) {
if (self.packPrice&&packageUnitPrice.text.length > 0) {
if (packageQuantity.text.length > 0) {
float totalPrice = [packageUnitPrice.text floatValue] * [packageQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.4f",totalPrice];
float totalPrice = [self.packPrice floatValue] * [packageQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.2f",totalPrice];
self.totalPrice = [NSNumber numberWithFloat:totalPrice];
if (foundationQuantity.text.length > 0 && [foundationQuantity.text integerValue] > 0) {
float packagePrice = totalPrice / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
}
foundationUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.basePrice = [NSNumber numberWithFloat:packagePrice]; }
}
}
}
......@@ -503,12 +519,14 @@ typedef enum : NSUInteger {
- (void)setUnitAndPackPrice{
if (totalMoney.text.length > 0) {
if (packageQuantity.text.length > 0 && [packageQuantity.text floatValue] > 0) {
float packagePrice = [totalMoney.text floatValue] / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
float packagePrice = [self.totalPrice floatValue] / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.packPrice = [NSNumber numberWithFloat:packagePrice];
}
if (foundationQuantity.text.length > 0 && [foundationQuantity.text floatValue] > 0) {
float packagePrice = [totalMoney.text floatValue] / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.4f",packagePrice];
float packagePrice = [self.totalPrice floatValue] / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.basePrice = [NSNumber numberWithFloat:packagePrice];
}
}
}
......
......@@ -33,9 +33,10 @@
UILabel *_choosePackPriceLabel;
UILabel *_chooseBasePriceLabel;
UILabel *_chooseTotalLabel;
UILabel *_chooseTotalPriceLabel;
UILabel *_chooseTotalPriceLabel;
UITextField *_shPackField;
UITextField *_shBaseQuantityField;
UILabel *_shjcLabel;
......@@ -152,8 +153,7 @@
}
self.noticeProduct.rctQty =[NSNumber numberWithFloat:[_shPackField.text floatValue]];
self.noticeProduct.rctBaseQty = [NSNumber numberWithFloat:[_shBaseQuantityField.text floatValue]];;
self.noticeProduct.rctTotal = [NSNumber numberWithFloat:[_chooseTotalPriceLabel.text floatValue]];
self.noticeProduct.rctBaseQty = [NSNumber numberWithFloat:[_shBaseQuantityField.text floatValue]];
self.noticeProduct.note = _noteTextView.text;
return YES;
}
......@@ -251,36 +251,43 @@
}
}
- (void)prepareDataIncell{
//商品
_chooseProductLabel.text = [NSString stringWithFormat:@"%@[%@]",self.noticeProduct.productName,self.noticeProduct.productCode];
//包装单位
_choosePackUnitLabel.text = self.noticeProduct.unit;
//包装规格
_choosePackStandLabel.text = [NSString stringWithFormat:@"1*%@ %@",[self.noticeProduct.qpc stringValue],self.noticeProduct.baseUnit];
//待收包装数量
_choosePackCountLabel.text = [NSString stringWithFormat:@"%@ %@",[self.noticeProduct.qty stringValue],self.noticeProduct.unit];
//待收基础数量
_chooseBaseCountLabel.text = [NSString stringWithFormat:@"%@ %@",[self.noticeProduct.baseQty stringValue],self.noticeProduct.baseUnit];
_chooseTotalLabel.text = [NSString stringWithFormat:@"%@元",[self.noticeProduct.total stringValue]];
_choosePackPriceLabel.text = [NSString stringWithFormat:@"%@ 元",[self.noticeProduct.packprice stringValue]];
_chooseBasePriceLabel.text = [NSString stringWithFormat:@"%@ 元",[self.noticeProduct.price stringValue]];
//待收总金额
_chooseTotalLabel.text = [NSString stringWithFormat:@"%.2f元",[self.noticeProduct.total floatValue]];
//包装单价
_choosePackPriceLabel.text = [NSString stringWithFormat:@"%.2f 元",[self.noticeProduct.packprice floatValue]];
//基础单价
_chooseBasePriceLabel.text = [NSString stringWithFormat:@"%.2f 元",[self.noticeProduct.price floatValue]];
_shbzLabel.text = self.noticeProduct.unit;
_shjcLabel.text = self.noticeProduct.baseUnit;
//实收基础数量
if (self.noticeProduct.rctBaseQty) {
_shBaseQuantityField.text =[NSString stringWithFormat:@"%@",[self.noticeProduct.rctBaseQty stringValue]];
}
//实收包装数量
if (self.noticeProduct.rctQty) {
_shPackField.text =[NSString stringWithFormat:@"%@",[self.noticeProduct.rctQty stringValue]];
}
//实收总金额
if (self.noticeProduct.rctTotal) {
_chooseTotalPriceLabel.text = [NSString stringWithFormat:@"%@ 元",[self.noticeProduct.rctTotal stringValue]];
_chooseTotalPriceLabel.text = [NSString stringWithFormat:@"%.2f 元",[self.noticeProduct.rctTotal floatValue]];
}else {
_chooseTotalPriceLabel.text = @"0.0000元";
_chooseTotalPriceLabel.text = @"0.00元";
}
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// if (indexPath.row == _dataArr.count - 1) {
// return TableRowHeight *2;
// }
return TableRowHeight;
}
......@@ -288,25 +295,37 @@
- (void)textChange:(UITextField *)textField{
if (textField == _shPackField) {
if (_shPackField.text.length > 0) {
float total = [_shPackField.text floatValue] * [self.noticeProduct.packprice floatValue];
float baseCount = 0;
if ([self.noticeProduct.price floatValue] > 0) {
baseCount = total / [self.noticeProduct.price floatValue];
//基础数量【实收】= 包装数量【实收】* 规格
float baseCount = [_shPackField.text floatValue] * [self.noticeProduct.qpc floatValue];
_shBaseQuantityField.text = [NSString stringWithFormat:@"%.2f",baseCount];
//总金额【实收】= 基础数量【实收】* 基础单价
float total = 0;
if ([_shPackField.text floatValue] == [self.noticeProduct.qty floatValue]) {
total = [self.noticeProduct.total floatValue];
}else{
total = baseCount * [self.noticeProduct.price floatValue];
}
_chooseTotalPriceLabel.text = [NSString stringWithFormat:@"%.4f元",total];
_shBaseQuantityField.text = [NSString stringWithFormat:@"%.2f",baseCount];
_chooseTotalPriceLabel.text = [NSString stringWithFormat:@"%.2f元",total];
self.noticeProduct.rctTotal = [NSNumber numberWithFloat:total];
}
}else if (textField == _shBaseQuantityField) {
if (_shBaseQuantityField.text.length > 0) {
float total = [_shBaseQuantityField.text floatValue] * [self.noticeProduct.price floatValue];
// 包装数量【实收】= 基础数量【实收】/ 规格
float baseCount = 0;
if ([self.noticeProduct.packprice floatValue] > 0) {
baseCount = total / [self.noticeProduct.packprice floatValue];
if ([self.noticeProduct.qpc floatValue] > 0) {
baseCount = [_shBaseQuantityField.text floatValue]/ [self.noticeProduct.qpc floatValue];
}
_chooseTotalPriceLabel.text = [NSString stringWithFormat:@"%.4f元",total];
_shPackField.text = [NSString stringWithFormat:@"%.2f",baseCount];
float total = 0;
if ([_shPackField.text floatValue] == [self.noticeProduct.qty floatValue]) {
total = [self.noticeProduct.total floatValue];
}else{
total = baseCount * [self.noticeProduct.price floatValue];
}
_chooseTotalPriceLabel.text = [NSString stringWithFormat:@"%.2f元",total];
self.noticeProduct.rctTotal = [NSNumber numberWithFloat:total];
}
}
}
......
......@@ -173,12 +173,12 @@
self.showshjcCountLabel.text = [NSString stringWithFormat:@"基础数量[实收]:%@%@",transferProduct.rctBaseQty?[transferProduct.rctBaseQty stringValue]:@"0",transferProduct.baseUnit];
self.showbzPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",[transferProduct.packprice stringValue]];
self.showjcPriceLabel.text = [NSString stringWithFormat:@"基础单价:%@元",[transferProduct.price stringValue]];
self.showbzPriceLabel.text = [NSString stringWithFormat:@"包装单价:%.2f元",[transferProduct.packprice floatValue]];
self.showjcPriceLabel.text = [NSString stringWithFormat:@"基础单价:%.2f元",[transferProduct.price floatValue]];
self.showshTotalLabel.text = [NSString stringWithFormat:@"总金额[实收]:%@元",transferProduct.rctTotal?[transferProduct.rctTotal stringValue]:@"0"];
self.showshTotalLabel.text = [NSString stringWithFormat:@"总金额[实收]:%.2f元",transferProduct.rctTotal?[transferProduct.rctTotal floatValue]:0.00f];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",transferProduct.total?[transferProduct.total stringValue]:@"0"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%.2f元",transferProduct.total?[transferProduct.total floatValue]:0.00f];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",transferProduct.note ? transferProduct.note :@"无" ];
if ([state isEqualToString:@"YES"]) {
if ([transferProduct.qty floatValue] > [transferProduct.rctQty floatValue]) {
......
......@@ -17,6 +17,7 @@
#import "ShopDetaileViewController.h"
#import "TransportPdtDetail.h"
#import "ChooseTransportViewController.h"
#import "ChooseTransferViewController.h"
typedef enum : NSUInteger {
SaveTag = 7000,
CommitTag,
......@@ -49,6 +50,7 @@ typedef enum : NSUInteger {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addTransferCost:) name:KNOTIFICATION_AddTransportCost object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addPurchferProduct:) name:KNOTIFICATION_AddPurchaseProduct object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(chooseTransportProduct) name:KNOTIFICATION_ChoseTransportProduct object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(chooseTransferProduct) name:KNOTIFICATION_ChoseTransferProduct object:nil];
}
return self;
}
......@@ -300,6 +302,18 @@ typedef enum : NSUInteger {
};
[self PushViewController:tpv animated:YES];
}
- (void)chooseTransferProduct{
ChooseTransferViewController *ctv = [ChooseTransferViewController new];
ctv.chooseTransferProduct = ^(NSArray *products){
if (products.count > 0) {
[_bottomView reProduct:products];
}
};
[self PushViewController:ctv animated:YES];
}
- (void)addTransferCost:(NSNotification *)fination{
NewCostViewController *nvc = [NewCostViewController new];
......@@ -386,10 +400,10 @@ typedef enum : NSUInteger {
shopDetail.packageSpecification = [billProduct.qpc stringValue];
shopDetail.packageUnit = billProduct.unit;
shopDetail.packageQuantity = [billProduct.qty stringValue];
shopDetail.packageUnitPrice = [billProduct.packprice stringValue];
shopDetail.foundationUnitPrice= [billProduct.price stringValue];
shopDetail.packageUnitPrice = billProduct.packprice;
shopDetail.foundationUnitPrice= billProduct.price;
shopDetail.foundationQuantity= [billProduct.baseQty stringValue];
shopDetail.totalMoney= [billProduct.total stringValue];
shopDetail.totalMoney= billProduct.total;
shopDetail.remark = billProduct.note;
shopDetail.packageQpcUnit = billProduct.baseUnit;
shopDetail.packageQpcStr = billProduct.qpcStr;
......
......@@ -69,7 +69,7 @@
#pragma mark - headCellDelegate
- (void)addClickList{
if (!self.popView) {
NSArray *arr = @[@"添加商品明细",@"选择采购单",@"选择发运单"];
NSArray *arr = @[@"添加商品明细",@"选择采购单",@"选择发运单",@"选择转运单"];
self.popView = [[GXFPopView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height) withArr:arr];
self.popView.delegate = self;
[AppWindow addSubview:self.popView];
......@@ -87,6 +87,8 @@
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransportPurchase object:nil];
}else if ([str isEqualToString:@"选择发运单"]){
[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransportProduct object:nil];
}else if ([str isEqualToString:@"选择转运单"]){
// [[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_ChoseTransferProduct object:nil];
}
}
- (void)clearFromSuper{
......
//
// ChooseTansferCell.h
// XFFruit
//
// Created by 陈俊俊 on 15/11/10.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Transfer.h"
@interface ChooseTansferCell : UITableViewCell<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,strong)UIView *bgView;
@property (nonatomic,strong)UILabel *titleLabel;
@property (nonatomic,strong)UILabel *lineLabel;
@property (nonatomic,strong)UILabel *secondLabel;
@property (nonatomic,strong)UILabel *threeLabel;
@property (nonatomic,strong)UITableView *secondTable;
@property (nonatomic,strong)NSMutableArray *secondArr;
@property (nonatomic,strong)NSMutableArray *indexArr;
@property (nonatomic,strong)NSMutableArray *selectArr;
- (void)setTransfer:(Transfer *)bill selectArr:(NSMutableArray *)selectArr;
@end
//
// ChooseTansferCell.m
// XFFruit
//
// Created by 陈俊俊 on 15/11/10.
// Copyright © 2015年 Xummer. All rights reserved.
//
#import "ChooseTansferCell.h"
#import "TransferProductCell.h"
#import "HeaderCell.h"
#define TableHeight 44
#define ShowHeight 110
@implementation ChooseTansferCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self bulidLayout];
}
return self;
}
- (void)bulidLayout
{
self.contentView.backgroundColor = XXFBgColor;
self.bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 170)];
self.bgView.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:self.bgView];
self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0,0, ScreenSize.width, 1))];;
self.lineLabel.backgroundColor = GXF_LINE_COLOR;
self.titleLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0, 0, ScreenSize.width, 44))];
self.titleLabel.textColor = GXF_NAVIGAYION_COLOR;
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.font = GXF_SEVENTEENTH_SIZE;
self.secondLabel = [[UILabel alloc]initWithFrame:(CGRectMake(0,44-1, ScreenSize.width, 1))];;
self.secondLabel.backgroundColor = GXF_LINE_COLOR;
[self.bgView addSubview:self.titleLabel];
[self.bgView addSubview:self.lineLabel];
[self.bgView addSubview:self.secondLabel];
self.secondTable = [[UITableView alloc]initWithFrame:(CGRectMake(0, 44,ScreenSize.width, self.bgView.height-45)) style:(UITableViewStylePlain)];
self.secondTable.delegate = self;
self.secondTable.dataSource = self;
self.secondTable.bounces = NO;
self.secondTable.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.bgView addSubview:self.secondTable];
NSArray *arr = @[@"商品",@"单价",@"包装数量"];
HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr withHiddenEdit:YES];
self.secondTable.tableHeaderView = headCell;
}
//转运单商品
- (void)setTransfer:(Transfer *)bill selectArr:(NSMutableArray *)selectArr{
self.bgView.height = 92 + bill.pdtDetails.count * 44;
self.secondTable.height = self.bgView.height - 45;
self.titleLabel.text = [NSString stringWithFormat:@"转单号:%@",bill.billnumber];
self.secondArr = [NSMutableArray array];
self.selectArr = selectArr;
[self.secondArr addObjectsFromArray:bill.pdtDetails];
//重要
[self.secondTable reloadData];
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.secondArr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellID = @"TransferProductCell";
TransferProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if (cell == nil) {
cell = [[TransferProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID withImageName:@"selected"];
cell.editBtn.hidden = YES;
cell.rightImageName = @"edit";
}
if (self.secondArr.count > 0) {
TransferPdtDetail * billProduct = self.secondArr[indexPath.row];
[cell setPdtDetail:billProduct row:indexPath.row];
if ([self isHaveIndexPath:billProduct]) {
cell.editBtn.hidden = NO;
}else{
cell.editBtn.hidden = YES;
}
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return TableHeight;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
TransferProductCell *cell = (TransferProductCell *)[tableView cellForRowAtIndexPath:indexPath];
TransferPdtDetail * billProduct = self.secondArr[indexPath.row];
if (![self isHaveIndexPath:billProduct]) {
cell.editBtn.hidden = NO;
[self.selectArr addObject:billProduct];
}else{
[self.selectArr removeObject:billProduct];
cell.editBtn.hidden = YES;
}
[self.secondTable reloadData];
}
- (BOOL)isHaveIndexPath:(TransferPdtDetail *)billProduct{
for (TransferPdtDetail *detail in self.selectArr) {
if (detail.uuid == billProduct.uuid || [detail.uuid isEqualToString:billProduct.uuid]) {
return YES;
}
}
return NO;
}
@end
......@@ -144,13 +144,13 @@
- (void)setPdtDetail:(TransferPdtDetail *)pdtDetail row:(NSInteger)row{
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = pdtDetail.productName;
self.priceLabel.text = [NSString stringWithFormat:@"%@元",[pdtDetail.price stringValue]];
self.priceLabel.text = [NSString stringWithFormat:@"%.2f元",[pdtDetail.price floatValue]];
self.countLabel.text = [NSString stringWithFormat:@"%@%@",[pdtDetail.qty stringValue],pdtDetail.unit];
self.showNameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",pdtDetail.productName,pdtDetail.productCode];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[pdtDetail.qpc stringValue],pdtDetail.baseUnit];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",[pdtDetail.qty stringValue],pdtDetail.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",[pdtDetail.baseQty stringValue],pdtDetail.baseUnit];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",[pdtDetail.packprice stringValue]];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%.2f元",[pdtDetail.packprice floatValue]];
NSString *sourceT = @"";
if ([pdtDetail.sourcetype isEqualToString:@"none"]) {
sourceT = @"无";
......@@ -162,7 +162,7 @@
self.showPurchaseLabel.text = [NSString stringWithFormat:@"来源类型:%@",sourceT];
self.showSourceNumberLabel.text = [NSString stringWithFormat:@"来源单号:%@",pdtDetail.sourcebillnumber.length > 0 ?pdtDetail.sourcebillnumber : @"无"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",[pdtDetail.total stringValue]];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%.2f元",[pdtDetail.total floatValue]];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note ? pdtDetail.note :@"无"];
}
......
......@@ -385,10 +385,10 @@ typedef enum : NSUInteger {
shopDetail.packageSpecification = [billProduct.qpc stringValue];
shopDetail.packageUnit = billProduct.unit;
shopDetail.packageQuantity = [billProduct.qty stringValue];
shopDetail.packageUnitPrice = [billProduct.packprice stringValue];
shopDetail.foundationUnitPrice= [billProduct.price stringValue];
shopDetail.packageUnitPrice = billProduct.packprice;
shopDetail.foundationUnitPrice= billProduct.price;
shopDetail.foundationQuantity= [billProduct.baseQty stringValue];
shopDetail.totalMoney= [billProduct.total stringValue];
shopDetail.totalMoney= billProduct.total;
shopDetail.remark = billProduct.note;
shopDetail.sourceDetail = billProduct.purchasePdtDetail;
shopDetail.sourceBillNumber = billProduct.purchasebillnumber;
......
......@@ -71,17 +71,6 @@
self.selectArr = selectArr;
[self.secondArr addObjectsFromArray:bill.products];
// self.secondTable = [[UITableView alloc]initWithFrame:(CGRectMake(0, 44,ScreenSize.width, self.bgView.height-45)) style:(UITableViewStylePlain)];
//
// self.secondTable.delegate = self;
// self.secondTable.dataSource = self;
//// self.secondTable.bounces = NO;
// self.secondTable.separatorStyle = UITableViewCellSeparatorStyleNone;
// [self.bgView addSubview:self.secondTable];
// NSArray *arr = @[@"商品",@"单价",@"包装数量"];
//
// HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
// self.secondTable.tableHeaderView = headCell;
//重要
[self.secondTable reloadData];
}
......
......@@ -150,15 +150,15 @@
- (void)setPdtDetail:(TransportPdtDetail *)pdtDetail row:(NSInteger)row{
self.seqLabel.text = [NSString stringWithFormat:@"%@",@(row+1)];
self.titleLabel.text = pdtDetail.productName;
self.priceLabel.text = [NSString stringWithFormat:@"%@元",[pdtDetail.price stringValue]];
self.priceLabel.text = [NSString stringWithFormat:@"%.2f元",[pdtDetail.price floatValue]];
self.countLabel.text = [NSString stringWithFormat:@"%@%@",[pdtDetail.qty stringValue],pdtDetail.unit];
self.showNameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",pdtDetail.productName,pdtDetail.productCode];
self.showStandLabel.text = [NSString stringWithFormat:@"包装规格:1*%@%@",[pdtDetail.qpc stringValue],pdtDetail.baseUnit];
self.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",[pdtDetail.qty stringValue],pdtDetail.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",[pdtDetail.baseQty stringValue],pdtDetail.baseUnit];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%@元",[pdtDetail.packprice stringValue]];
self.showPriceLabel.text = [NSString stringWithFormat:@"包装单价:%.2f元",[pdtDetail.packprice floatValue]];
self.showPurchaseLabel.text = [NSString stringWithFormat:@"采购单号:%@",pdtDetail.purchasebillnumber.length > 0 ? pdtDetail.purchasebillnumber: @"无"];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",[pdtDetail.total stringValue]];
self.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%.2f元",[pdtDetail.total floatValue]];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",pdtDetail.note ? pdtDetail.note :@"无"];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment