Commit c63ff51b authored by Sandy's avatar Sandy

修复计算精度问题

parent 95c407fd
......@@ -22,6 +22,7 @@
04B4A3871B9CAAD700D88D68 /* ShopDetail.m in Sources */ = {isa = PBXBuildFile; fileRef = 04B4A3861B9CAAD700D88D68 /* ShopDetail.m */; };
04E721E31BA755FD008F9158 /* ProductUnit.m in Sources */ = {isa = PBXBuildFile; fileRef = 04E721E21BA755FD008F9158 /* ProductUnit.m */; };
04F6E70A1B9B08A500550849 /* PurchaseNoticeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 04F6E7091B9B08A500550849 /* PurchaseNoticeViewController.m */; };
19605F981D377CA500C20590 /* CalculateHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 19605F971D377CA500C20590 /* CalculateHelper.m */; };
19D20B8B1D1BC11000BF7FE2 /* NSDictionary+Category.m in Sources */ = {isa = PBXBuildFile; fileRef = 19D20B8A1D1BC11000BF7FE2 /* NSDictionary+Category.m */; };
300DD94A1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; };
300DD94B1B184B450080EE12 /* ICRPatrolPlan.m in Sources */ = {isa = PBXBuildFile; fileRef = 300DD9491B184B450080EE12 /* ICRPatrolPlan.m */; };
......@@ -544,6 +545,8 @@
04E721E21BA755FD008F9158 /* ProductUnit.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductUnit.m; sourceTree = "<group>"; };
04F6E7081B9B08A500550849 /* PurchaseNoticeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseNoticeViewController.h; sourceTree = "<group>"; };
04F6E7091B9B08A500550849 /* PurchaseNoticeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseNoticeViewController.m; sourceTree = "<group>"; };
19605F961D377CA500C20590 /* CalculateHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CalculateHelper.h; sourceTree = "<group>"; };
19605F971D377CA500C20590 /* CalculateHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CalculateHelper.m; sourceTree = "<group>"; };
19D20B891D1BC11000BF7FE2 /* NSDictionary+Category.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+Category.h"; sourceTree = "<group>"; };
19D20B8A1D1BC11000BF7FE2 /* NSDictionary+Category.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+Category.m"; sourceTree = "<group>"; };
1B0B22845F5CD40B5CF655F2 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
......@@ -2143,6 +2146,8 @@
C142D2911AC3A154000109A7 /* Categories */,
C142D2901AC3A12C000109A7 /* Classes */,
C142D28F1AC3A10F000109A7 /* Views */,
19605F961D377CA500C20590 /* CalculateHelper.h */,
19605F971D377CA500C20590 /* CalculateHelper.m */,
);
path = General;
sourceTree = "<group>";
......@@ -3178,6 +3183,7 @@
C123A9221B26ED85003C0C36 /* ICRQuestionManager.m in Sources */,
C15918801AC4362D0013B391 /* UIApplication+CheckFirstRun.m in Sources */,
72A814001BCD3B0A003631F3 /* NewReceiveViewController.m in Sources */,
19605F981D377CA500C20590 /* CalculateHelper.m in Sources */,
0460F6711BA8B3FC004A073D /* FollowUpRecordViewController.m in Sources */,
049957E51C8C1CFD003388D3 /* BottomPurchaseView.m in Sources */,
C1F696091AB870B400F9F5DD /* main.m in Sources */,
......
//
// CalculateHelper.h
// XFFruit
//
// Created by Z on 16/7/14.
// Copyright © 2016年 Xummer. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef NS_ENUM(NSInteger, CalculateType) {
CalculateTypeAdd = 0, //加
CalculateTypeSub, //减
CalculateTypeMul, //乘
CalculateTypeDiv //除
};
@interface CalculateHelper : NSObject
/*
NSRoundPlain, // Round up on a tie //貌似取整
NSRoundDown, // Always down == truncate //只舍不入
NSRoundUp, // Always up // 只入不舍
NSRoundBankers // on a tie round so last digit is even 貌似四舍五入
*/
/**
* 计算
*
* @param num1 第一个数字
* @param num2 第二个数字
* @param type 计算类型(加减乘除)
* @param roundingType 四舍五入类型
* @param coutLenth 小数点后面保留几位
*
* @return 结算结果
*/
+ (NSDecimalNumber *)calculateNum1:(id)num1 num2:(id)num2 type:(CalculateType)type roundingType:(NSRoundingMode)roundingType cutLenth:(NSInteger)coutLenth;
+ (NSString *)getMoneyStringFrom:(id)num Lenth:(NSInteger)cutLenth;
+ (NSString *)getMoneyStringFrom:(id)num;
@end
//
// CalculateHelper.m
// XFFruit
//
// Created by Z on 16/7/14.
// Copyright © 2016年 Xummer. All rights reserved.
//
#import "CalculateHelper.h"
@implementation CalculateHelper
+ (NSDecimalNumber *)calculateNum1:(id)num1 num2:(id)num2 type:(CalculateType)type roundingType:(NSRoundingMode)roundingType cutLenth:(NSInteger)coutLenth {
NSDecimalNumberHandler *roundUp = [NSDecimalNumberHandler
decimalNumberHandlerWithRoundingMode:roundingType
scale:coutLenth
raiseOnExactness:NO
raiseOnOverflow:NO
raiseOnUnderflow:NO
raiseOnDivideByZero:YES];
NSDecimalNumber *decimalNum1 = [self changeType:num1];
NSDecimalNumber *decimalNum2 = [self changeType:num2];
NSDecimalNumber *decimalResult;
NSString *result;
switch (type) {
case CalculateTypeAdd: {
decimalResult = [decimalNum1 decimalNumberByAdding:decimalNum2 withBehavior:roundUp];
result = [decimalResult stringValue];
break;
}
case CalculateTypeSub: {
decimalResult = [decimalNum1 decimalNumberBySubtracting:decimalNum2 withBehavior:roundUp];
result = [decimalResult stringValue];
break;
}
case CalculateTypeMul: {
decimalResult = [decimalNum1 decimalNumberByMultiplyingBy:decimalNum2 withBehavior:roundUp];
result = [decimalResult stringValue];
break;
}
case CalculateTypeDiv: {
decimalResult = [decimalNum1 decimalNumberByDividingBy:decimalNum2 withBehavior:roundUp];
result = [decimalResult stringValue];
break;
}
}
return decimalResult;
}
+ (NSDecimalNumber *)changeType:(id)num1 {
NSDecimalNumber *decimalNum1;
if ([num1 isKindOfClass:[NSDecimalNumber class]]) {
decimalNum1 = num1;
}else if([num1 isKindOfClass:[NSString class]]){
decimalNum1 = [NSDecimalNumber decimalNumberWithString:num1];
}else if ([num1 isKindOfClass:[NSNumber class]]){
decimalNum1 = [NSDecimalNumber decimalNumberWithDecimal:[num1 decimalValue]];
}else if(num1 == nil){
decimalNum1 = [NSDecimalNumber decimalNumberWithString:@"0"];
}
return decimalNum1;
}
+ (NSString *)getMoneyStringFrom:(id)num Lenth:(NSInteger)cutLenth {
NSDecimalNumberHandler *roundUp = [NSDecimalNumberHandler
decimalNumberHandlerWithRoundingMode:NSRoundBankers
scale:cutLenth ? cutLenth : 2
raiseOnExactness:NO
raiseOnOverflow:NO
raiseOnUnderflow:NO
raiseOnDivideByZero:YES];
NSDecimalNumber *decimal = [self changeType:num];
NSDecimalNumber *result = [decimal decimalNumberByAdding:[NSDecimalNumber decimalNumberWithString:@"0"] withBehavior:roundUp];
return [result stringValue];
}
+ (NSString *)getMoneyStringFrom:(id)num{
NSString *originString = [self getMoneyStringFrom:num Lenth:2];
NSArray *array = [originString componentsSeparatedByString:@"."];
NSString *top = array[0];
NSString *result;
if (array.count == 1) {
result = [NSString stringWithFormat:@"%@.00",top];
}else if(array.count == 2){
NSString *bottom = array[1];
if (bottom.length == 2) {
result = originString;
}
NSString *chr;
for (NSInteger i = bottom.length; i < 2; i++) {
chr =[bottom substringWithRange:NSMakeRange(i, 1)];
if ([chr isEqualToString:@"0"]) {
result = [top stringByAppendingString:chr];
}
}
}
return result;
}
@end
......@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.6</string>
<string>1.2.8</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
......
......@@ -19,6 +19,7 @@
#import "BottomPurchaseView.h"
#import "NewCostViewController.h"
#import "FeeAcountDetail.h"
#import "CalculateHelper.h"
#define TopHeight 328
#define BottomHeight 300
#define SpaceHeight 20
......@@ -112,7 +113,6 @@ typedef enum : NSUInteger {
- (void)prepareDataInCell{
_purchaseView.bill = self.purchaseBill;
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *productDict in self.purchaseBill.products) {
PurchaseBillProduct *billProduct = [[PurchaseBillProduct alloc]init];
......@@ -191,26 +191,27 @@ typedef enum : NSUInteger {
//添加商品明细,更新上部显示的费用
- (void)setProductTotalPrice:(NSNotification *)fication{
//计算总金额
float otherPrice = 0;
NSDecimalNumber *otherPrice = [NSDecimalNumber decimalNumberWithString:@"0"];
// if (_aBottomView.costVC.costArr.count == 0) {
// otherPrice = [_purchaseView.otherPriceFiled.text floatValue];
// }else{
for (FeeAcountDetail *cost in _aBottomView.costVC.costArr) {
otherPrice += [cost.leftmoney floatValue];
otherPrice = [CalculateHelper calculateNum1:otherPrice num2:cost.leftmoney type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10];
}
_purchaseView.otherPriceFiled.text = [NSString stringWithFormat:@"%.2f", otherPrice];
_purchaseView.otherPriceFiled.text = [NSString stringWithFormat:@"%@", otherPrice];
// }
//其他费用 + 商品总金额
NSMutableArray *purchaseProduct = _aBottomView.productVC.productArr;
float totalPrice = 0;
NSDecimalNumber *totalPrice = [NSDecimalNumber decimalNumberWithString:@"0"];
for (PurchaseBillProduct *billProduct in purchaseProduct) {
totalPrice += [billProduct.total floatValue];
totalPrice = [CalculateHelper calculateNum1:totalPrice num2:billProduct.total type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:10];
}
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%.2f",totalPrice + otherPrice];
_purchaseView.total = [NSNumber numberWithFloat:totalPrice+otherPrice];
_purchaseView.chargePurchase = [NSNumber numberWithFloat:otherPrice];
NSDecimalNumber *all = [CalculateHelper calculateNum1:totalPrice num2:otherPrice type:CalculateTypeAdd roundingType:NSRoundBankers cutLenth:2];
_purchaseView.purchasePriceLabel.text = [NSString stringWithFormat:@"%@",[all stringValue]];
_purchaseView.total = all;
_purchaseView.chargePurchase = otherPrice;
......@@ -415,13 +416,13 @@ typedef enum : NSUInteger {
billProduct.product_uuid = shopDetail.product_uuid;
billProduct.product_code = shopDetail.product_code;
billProduct.product_name = shopDetail.merchandise;
billProduct.qpc = [NSNumber numberWithFloat:[shopDetail.packageSpecification floatValue]];
billProduct.qpc = [NSDecimalNumber decimalNumberWithString:shopDetail.packageSpecification];
billProduct.unit = shopDetail.packageUnit;
billProduct.qty = [NSNumber numberWithFloat:[shopDetail.packageQuantity floatValue]];
billProduct.price = [NSNumber numberWithFloat:[shopDetail.packageUnitPrice floatValue]];
billProduct.baseQty = [NSNumber numberWithFloat:[shopDetail.foundationQuantity floatValue]];
billProduct.basePrice = [NSNumber numberWithFloat:[shopDetail.foundationUnitPrice floatValue]];
billProduct.total = [NSNumber numberWithFloat:[shopDetail.totalMoney floatValue]];
billProduct.qty = [NSDecimalNumber decimalNumberWithString:shopDetail.packageQuantity];
billProduct.price = shopDetail.packageUnitPrice;
billProduct.baseQty = [NSDecimalNumber decimalNumberWithString:shopDetail.foundationQuantity];
billProduct.basePrice = shopDetail.foundationUnitPrice;
billProduct.total = shopDetail.totalMoney;
billProduct.remark = shopDetail.remark;
billProduct.qpcStr = shopDetail.packageQpcStr ? shopDetail.packageQpcStr : @"无";
billProduct.baseUnit = shopDetail.packageQpcUnit;
......@@ -433,11 +434,11 @@ typedef enum : NSUInteger {
shopDetail.product_uuid = billProduct.product_uuid;
shopDetail.product_code = billProduct.product_code;
shopDetail.merchandise = billProduct.product_name;
shopDetail.packageSpecification = [billProduct.qpc stringValue];
shopDetail.packageSpecification = [CalculateHelper getMoneyStringFrom:billProduct.qpc Lenth:0];
shopDetail.packageUnit = billProduct.unit;
shopDetail.packageQuantity = [billProduct.qty stringValue];
shopDetail.packageQuantity = [CalculateHelper getMoneyStringFrom:billProduct.qty Lenth:0];
shopDetail.packageUnitPrice = billProduct.price;
shopDetail.foundationQuantity= [billProduct.baseQty stringValue];
shopDetail.foundationQuantity= [CalculateHelper getMoneyStringFrom:billProduct.baseQty Lenth:0];
shopDetail.foundationUnitPrice= billProduct.basePrice;
shopDetail.totalMoney= billProduct.total;
shopDetail.remark = billProduct.remark;
......
......@@ -152,11 +152,11 @@
self.showNameLabel.text = [NSString stringWithFormat:@"商品:%@[%@]",billProduct.product_name,billProduct.product_code];
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.showCountLabel.text = [NSString stringWithFormat:@"包装数量:%@%@",billProduct.qty,billProduct.unit];
self.showBaseCountLabel.text =[NSString stringWithFormat:@"基础数量:%@%@",billProduct.baseQty ,billProduct.baseUnit];
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.showTotalLabel.text = [NSString stringWithFormat:@"总金额:%@元",[billProduct.total stringValue]];
self.showNoteLabel.text =[NSString stringWithFormat:@"备注:%@",billProduct.remark ? billProduct.remark :@"无" ];
[self isShowShippingQty:billProduct];
}
......
......@@ -15,6 +15,7 @@
#import "ChooseProductUnitViewController.h"
#import "GXFSearchVendorViewController.h"
#import "GXFProductUnit.h"
#import "CalculateHelper.h"
#define LeftMargin 15
#define BtnHeight 44
#define TableHeight 46
......@@ -131,20 +132,20 @@ typedef enum : NSUInteger {
foundationQuantity.text=self.shopDetail.foundationQuantity;
//基础单价
if ([self.shopDetail.foundationUnitPrice floatValue] > 0) {
foundationUnitPrice.text= [NSString stringWithFormat:@"%.2f",[self.shopDetail.foundationUnitPrice floatValue]];
foundationUnitPrice.text= [self.shopDetail.foundationUnitPrice stringValue];
}
self.basePrice = self.shopDetail.foundationUnitPrice;
//包装单价
if ([self.shopDetail.packageUnitPrice floatValue] > 0) {
packageUnitPrice.text=[NSString stringWithFormat:@"%.2f",[self.shopDetail.packageUnitPrice floatValue]];
packageUnitPrice.text=[self.shopDetail.packageUnitPrice stringValue];
}
self.packPrice = self.shopDetail.packageUnitPrice;
//总金额
if ([self.shopDetail.totalMoney floatValue] <= 0) {
totalMoney.text=@"0.0000";
}else{
totalMoney.text=[NSString stringWithFormat:@"%.2f",[self.shopDetail.totalMoney floatValue]];
totalMoney.text=[self.shopDetail.totalMoney stringValue];
}
self.totalPrice = self.shopDetail.totalMoney;
//备注
......@@ -240,8 +241,8 @@ typedef enum : NSUInteger {
self.shopDetail.foundationQuantity = foundationQuantity.text;
self.shopDetail.foundationUnitPrice = self.basePrice;
self.shopDetail.totalMoney = self.totalPrice;
NSString *totalPrices = totalMoney.text;
self.shopDetail.totalMoney = [NSDecimalNumber decimalNumberWithString:totalPrices];
self.shopDetail.remark = remark.text;
if (self.productNameStr.length == 0 ) {
......@@ -490,15 +491,24 @@ typedef enum : NSUInteger {
- (void)setPacktAndTotalPrice{
if (self.basePrice && foundationUnitPrice.text.length > 0) {
if (foundationQuantity.text.length > 0) {
float basePrice = [self.basePrice doubleValue];
float foundationQtt = [foundationQuantity.text doubleValue];
float totalPrice = basePrice * 1000 * foundationQtt;
totalMoney.text = [NSString stringWithFormat:@"%.2f",totalPrice / 1000];
self.totalPrice = [NSNumber numberWithFloat:totalPrice];
// float basePrice = [self.basePrice floatValue] * 100;
// int intBasePrice = (int)basePrice;
// int foundationQtt = [foundationQuantity.text intValue];
// double price = (intBasePrice * foundationQtt * 1.0);
// double totalPrice = price / 100;
// NSDecimalNumber *basePrice = [NSDecimalNumber decimalNumberWithDecimal:[self.basePrice decimalValue]];
// NSDecimalNumber *foundationQty = [NSDecimalNumber decimalNumberWithString:foundationQuantity.text];
// NSDecimalNumber *multiplyResult = [basePrice decimalNumberByMultiplyingBy:foundationQty];
NSDecimalNumber *multiplyResult = [CalculateHelper calculateNum1:self.basePrice num2:foundationQuantity.text type:CalculateTypeMul roundingType:NSRoundBankers cutLenth:2];
totalMoney.text = [multiplyResult stringValue];
self.totalPrice = multiplyResult;
if (packageQuantity.text.length > 0 && [packageQuantity.text floatValue] > 0) {
float packagePrice = totalPrice / [packageQuantity.text floatValue] / 1000;
packageUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.packPrice = [NSNumber numberWithFloat:packagePrice];
NSDecimalNumber *packagePrice = [CalculateHelper calculateNum1:multiplyResult num2:packageQuantity.text type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:2] ;
packageUnitPrice.text = [packagePrice stringValue];
self.packPrice = packagePrice;
}
}
}
......@@ -507,13 +517,21 @@ typedef enum : NSUInteger {
- (void)setUnitAndTotalPrice{
if (self.packPrice&&packageUnitPrice.text.length > 0) {
if (packageQuantity.text.length > 0) {
float totalPrice = [self.packPrice floatValue] * [packageQuantity.text floatValue];
totalMoney.text = [NSString stringWithFormat:@"%.2f",totalPrice];
self.totalPrice = [NSNumber numberWithFloat:totalPrice];
// float pakePrice = [self.packPrice floatValue] * 100;
// int intPakePrice = (int)pakePrice;
// int pakageQty = [packageQuantity.text intValue];
//
// double price = (intPakePrice * pakageQty * 1.0);
// double totalPrice = price / 100;
// float totalPrice = pakePrice * 100 * pakageQty / 100;
NSDecimalNumber *totalPrice = [CalculateHelper calculateNum1:self.packPrice num2:packageQuantity.text type:CalculateTypeMul roundingType:NSRoundBankers cutLenth:2];
totalMoney.text = [totalPrice stringValue];
self.totalPrice = totalPrice;
if (foundationQuantity.text.length > 0 && [foundationQuantity.text integerValue] > 0) {
float packagePrice = totalPrice / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.basePrice = [NSNumber numberWithFloat:packagePrice]; }
NSDecimalNumber *packagePrice = [CalculateHelper calculateNum1:totalPrice num2:foundationQuantity.text type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:2];
// float packagePrice = totalPrice / [foundationQuantity.text floatValue];
foundationUnitPrice.text = packagePrice.stringValue;
self.basePrice = packagePrice; }
}
}
}
......@@ -521,14 +539,18 @@ typedef enum : NSUInteger {
- (void)setUnitAndPackPrice{
if (totalMoney.text.length > 0) {
if (packageQuantity.text.length > 0 && [packageQuantity.text floatValue] > 0) {
float packagePrice = [self.totalPrice floatValue] / [packageQuantity.text floatValue];
packageUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.packPrice = [NSNumber numberWithFloat:packagePrice];
// float packagePrice = [self.totalPrice floatValue] / [packageQuantity.text floatValue];
NSDecimalNumber *packagePrice = [CalculateHelper calculateNum1:self.totalPrice num2:packageQuantity.text type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:2];
packageUnitPrice.text = packagePrice.stringValue;
self.packPrice = packagePrice;
}
if (foundationQuantity.text.length > 0 && [foundationQuantity.text floatValue] > 0) {
float packagePrice = [self.totalPrice floatValue] / [foundationQuantity.text floatValue];
foundationUnitPrice.text = [NSString stringWithFormat:@"%.2f",packagePrice];
self.basePrice = [NSNumber numberWithFloat:packagePrice];
// float packagePrice = [self.totalPrice floatValue] / [foundationQuantity.text floatValue];
NSDecimalNumber *packagePrice = [CalculateHelper calculateNum1:self.totalPrice num2:foundationQuantity.text type:CalculateTypeDiv roundingType:NSRoundBankers cutLenth:2];
foundationUnitPrice.text = packagePrice.stringValue;
self.basePrice = packagePrice;
}
}
}
......
......@@ -240,6 +240,7 @@
@"pageNumber":@0,
@"pageSize":@100
};
CLog(@"%@", dict);
[[ICRHTTPController sharedController] queryHomepageWith:dict success:succ failure:fail];
}
......@@ -355,10 +356,10 @@
NSDate *date ;
if (!_selectDay) {
self.selectDay = [[NSDate date]localYMDString];
//
//
}
date = [IBTCommon dateFromStringWithFormat:_selectDay format:@"yyyy-MM-dd" ];
// NSString *strDate = [_selectDay substringToIndex:_selectDay.length - 3];
// NSString *strDate = [_selectDay substringToIndex:_selectDay.length - 3];
//日周年切换
NSString *dayType = @"";
if ([title isEqualToString:SaleWeek]) {
......@@ -372,12 +373,12 @@
if ([title isEqualToString:SaleDay]) {
dayType = @"day";
self.scopeType = _selectDay;//[IBTCommon stringFromDateWithFormat:[NSDate date] format:@"yyyy-MM-dd"];
// }else if ([title isEqualToString:SaleWeek]) {
// dayType = @"week";
// self.scopeType = [IBTCommon getWeekFromDateWithDate:date];
// }else if ([title isEqualToString:SaleWeek]) {
// dayType = @"week";
// self.scopeType = [IBTCommon getWeekFromDateWithDate:date];
}else if ([title isEqualToString:SaleMonth]) {
dayType = @"month";
// date = [IBTCommon dateFromStringWithFormat:strDate format:@"yyyy-MM" ];
// date = [IBTCommon dateFromStringWithFormat:strDate format:@"yyyy-MM" ];
self.scopeType = [IBTCommon stringFromDateWithFormat:date format:@"yyyy-MM"];
} else {
return;
......@@ -401,6 +402,7 @@
}
}
//日期选择器开始的初始时间
- (void)startDatePickView:(NSString *)type{
if (!self.startTimeView) {
......
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