Commit 4f433e78 authored by Sandy's avatar Sandy

版本1.2.1

parent bb781be6
......@@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.11</string>
<string>1.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>104</string>
<string>1.2.1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
......
......@@ -22,10 +22,10 @@
#define VANKE_BAIDU_WEATHER_SERVER_URL @"http://api.map.baidu.com/telematics/v3/weather"
// 后台服务基准地址
//#define VANKE_SERVER_BASE_URL @"http://140.206.62.178:8080/wanke-server/rest"
#define VANKE_SERVER_BASE_URL @"http://140.206.62.178:8080/wanke-server/rest"
// 测试环境
#define VANKE_SERVER_BASE_URL @"http://218.244.151.129:7580/wanke-server/rest"
//#define VANKE_SERVER_BASE_URL @"http://218.244.151.129:7580/wanke-server/rest"
//#define VANKE_SERVER_BASE_URL @"http://139.196.39.77:8080/wanke-server/rest"
......
......@@ -133,7 +133,7 @@ ON_SIGNAL3(VankeAffairsBoard_iPhone, btnSaleInput, signal) {
SalesInputViewController *salesVC = [[SalesInputViewController alloc] init];
WS(weakSelf)
if ([[model getAuthOrgs] count] == 1) {
if ([[model getAuthOrgs] count] > 1) {
ChooseProjectTableViewController *chooseVC = [[ChooseProjectTableViewController alloc] init];
chooseVC.arrAuthorized = [model getAuthOrgs];
......
......@@ -32,11 +32,6 @@
[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithRed:0.953 green:0.439 blue:0.063 alpha:1.000]];
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:UIBarButtonItemStyleDone target:self action:@selector(cancellACtion)];
self.navigationItem.rightBarButtonItem = rightButton;
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:kCellID];
}
......@@ -66,7 +61,6 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID forIndexPath:indexPath];
cell.textLabel.text = [self.arrAuthorized[indexPath.row] name];
// Configure the cell...
return cell;
}
......
......@@ -18,11 +18,16 @@
@property (nonatomic, copy) NSString *searchText;
@property (nonatomic, strong) NSMutableArray *arrData;
@property (nonatomic, strong) NSArray *results;
@property (nonatomic, strong) VankeShopModel *shop;
@property (nonatomic, assign) BOOL isChoose;
@end
@implementation ChooseShopViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.arrData = [LoginShopsInstance shareInstance].arrShops;
self.results = [NSArray arrayWithArray:self.arrData];
......@@ -53,7 +58,7 @@
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {
self.searchText = searchText;
NSPredicate *pred = [NSPredicate predicateWithFormat:@"name contains [cd] %@", searchText];
NSPredicate *pred = [NSPredicate predicateWithFormat:@"name contains [cd] %@ OR code contains [cd] %@", searchText, searchText];
self.results = [self.arrData filteredArrayUsingPredicate:pred];
[self.tableView reloadData];
NSLog(@"df");
......@@ -103,8 +108,9 @@
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
VankeShopModel *shop = self.results[indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@", [self.results[indexPath.row] name]];
cell.textLabel.text = [NSString stringWithFormat:@"%@【%@】", shop.name, shop.code];
return cell;
}
......
......@@ -54,7 +54,13 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.topView.labelShopName.text = self.shop.name;
self.topView.labelShopName.text = [NSString stringWithFormat:@"%@【%@】", self.shop.name, self.shop.code];
if (self.shop == nil) {
self.topView.labelShopName.text = @"";
}else{
self.topView.labelShopName.text = [NSString stringWithFormat:@"%@【%@】", self.shop.name, self.shop.code];
}
}
- (void)setUPScrollView {
......@@ -167,7 +173,7 @@
- (void)setUpDatePicker {
UIDatePicker *startDatePicker = [[UIDatePicker alloc] init];
startDatePicker.date = [NSDate dateWithTimeInterval:-60 * 60 * 24 sinceDate:[NSDate date]];
startDatePicker.date = [NSDate date];
startDatePicker.tag = 1100;
startDatePicker.datePickerMode = UIDatePickerModeDate;
[startDatePicker addTarget:self action:@selector(oneDatePickerValueChanged:) forControlEvents:UIControlEventValueChanged];
......@@ -229,95 +235,99 @@
}
- (void)setUpData {
WS(weakSelf)
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
NSDate *endDate = [f dateFromString:self.topView.endDate.text];
NSDate *tomorrow = [NSDate dateWithTimeInterval:60 * 60 * 24 sinceDate:endDate];
NSString *endStr = [f stringFromDate:tomorrow];
NSDictionary *params = @{@"shopCodeEquals" : self.shop.code,
@"beginDateEquals" : self.topView.startDate.text,
@"endDateEquals" : endStr,
@"pageNumber" : @0,
@"pageSize" : @0};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl getUrl:@"salesinput/query" params:params success:^(id data) {
NSDictionary *dic = data;
if (self.shop == nil) {
NSMutableArray *arrData = [NSMutableArray array];
}else{
NSMutableArray *arrDate = [NSMutableArray array];//日期
[arrDate addObject:@"日期"];
NSMutableArray *arrAmount = [NSMutableArray array];//金额
[arrAmount addObject:@"金额(元)"];
NSMutableArray *payment = [NSMutableArray array];
for (NSDictionary *obj in dic[@"data"][@"records"]) {
[arrDate addObject:obj[@"salesDate"]];
[arrAmount addObject:[NSString stringWithFormat:@"%.0f", [obj[@"amount"] floatValue]]];
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *dic in obj[@"lines"]) {
[arr addObject:dic];
}
[payment addObject:arr];
}
WS(weakSelf)
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
NSDate *endDate = [f dateFromString:self.topView.endDate.text];
[arrData addObject:arrDate];
[arrData addObject:arrAmount];
NSDate *tomorrow = [NSDate dateWithTimeInterval:60 * 60 * 24 sinceDate:endDate];
NSString *endStr = [f stringFromDate:tomorrow];
NSMutableArray *paytype = [NSMutableArray array];
if (payment.count > 0) {
for (NSDictionary *dic in payment[0]) {
NSMutableArray *apay = [NSMutableArray array];
[apay addObject:dic[@"payment"]];
[paytype addObject:apay];
}
}
NSDictionary *params = @{@"shopCodeEquals" : self.shop.code,
@"beginDateEquals" : self.topView.startDate.text,
@"endDateEquals" : self.topView.endDate.text,
@"pageNumber" : @0,
@"pageSize" : @0};
for (NSArray *arr in payment) {
for (int i = 0; i < arr.count; i++) {
NSDictionary *dic = arr[i];
NSMutableArray *apay = paytype[i];
[apay addObject:[NSString stringWithFormat:@"%.0f", [dic[@"amount"] floatValue]]];
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl getUrl:@"salesinput/query" params:params success:^(id data) {
NSDictionary *dic = data;
NSMutableArray *arrData = [NSMutableArray array];
NSMutableArray *arrDate = [NSMutableArray array];//日期
[arrDate addObject:@"日期"];
NSMutableArray *arrAmount = [NSMutableArray array];//金额
[arrAmount addObject:@"金额(元)"];
NSMutableArray *payment = [NSMutableArray array];
for (NSDictionary *obj in dic[@"data"][@"records"]) {
[arrDate addObject:obj[@"salesDate"]];
[arrAmount addObject:[NSString stringWithFormat:@"%.0f", [obj[@"amount"] floatValue]]];
NSMutableArray *arr = [NSMutableArray array];
for (NSDictionary *dic in obj[@"lines"]) {
[arr addObject:dic];
}
[payment addObject:arr];
}
}
[arrData addObjectsFromArray:paytype];
NSMutableArray *arrBottom = [NSMutableArray array];
for (int i = 0; i < arrData.count; i++) {
if (i == 0) {
[arrBottom addObject:@"总计"];
}else{
[arrData addObject:arrDate];
[arrData addObject:arrAmount];
NSMutableArray *paytype = [NSMutableArray array];
if (payment.count > 0) {
for (NSDictionary *dic in payment[0]) {
NSMutableArray *apay = [NSMutableArray array];
[apay addObject:dic[@"payment"]];
[paytype addObject:apay];
}
}
for (NSArray *arr in payment) {
for (int i = 0; i < arr.count; i++) {
NSDictionary *dic = arr[i];
NSMutableArray *apay = paytype[i];
[apay addObject:[NSString stringWithFormat:@"%.0f", [dic[@"amount"] floatValue]]];
}
NSInteger count = 0;
for (int j = 0; j < [arrData[i] count]; j++) {
if (j != 0) {
NSString *number = arrData[i][j];
NSInteger num = [number integerValue];
count = count + num;
}
[arrData addObjectsFromArray:paytype];
NSMutableArray *arrBottom = [NSMutableArray array];
for (int i = 0; i < arrData.count; i++) {
if (i == 0) {
[arrBottom addObject:@"总计"];
}else{
NSInteger count = 0;
for (int j = 0; j < [arrData[i] count]; j++) {
if (j != 0) {
NSString *number = arrData[i][j];
NSInteger num = [number integerValue];
count = count + num;
}
}
NSString *result = [NSString stringWithFormat:@"%ld", (long)count];
[arrBottom addObject:result];
}
NSString *result = [NSString stringWithFormat:@"%ld", (long)count];
[arrBottom addObject:result];
}
}
[weakSelf setUpScrollViewWithDataArr:arrData bottomArr:arrBottom];
NSLog(@"d");
} failure:^(id data) {
}];
[weakSelf setUpScrollViewWithDataArr:arrData bottomArr:arrBottom];
NSLog(@"d");
} failure:^(id data) {
}];
}
}
......
......@@ -24,7 +24,7 @@
#define kCellCount 20
#define kCellID @"SalesInputTableViewCell.h"
@interface SalesInputViewController ()<UITableViewDelegate, UITableViewDataSource>
@interface SalesInputViewController ()<UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) SalesInputTopView *topView;
@property (nonatomic, strong) UIDatePicker *datePicker;
......@@ -34,6 +34,8 @@
@property (nonatomic, strong) NSMutableDictionary *cellDataDic;
@property (nonatomic, strong) NSMutableArray *arrPaymentType;
@property (nonatomic, strong) SalesInputCommitView *submitView;
@property (nonatomic, copy) NSString *todayTotalAmount;
@end
@implementation SalesInputViewController
......@@ -43,12 +45,17 @@
self.cellDataDic = [NSMutableDictionary dictionary];
self.view.backgroundColor = [UIColor whiteColor];
if ([LoginShopsInstance shareInstance].arrShops.count > 0) {
self.shop = [LoginShopsInstance shareInstance].arrShops[0];
}
[self setUpNavigationBar];
[self setUpTopView];
[self setUpTableView];
[self setUpTotalView];
[self setUpCommitView];
[self setUpData];
// Do any additional setup after loading the view.
}
......@@ -64,34 +71,18 @@
[super viewWillAppear:animated];
[[VankeAppBoard_iPhone sharedInstance] hideMenu];
if ([LoginShopsInstance shareInstance].arrShops.count > 1 && self.shop == nil) {
[self chooseShopAction];
}else if([LoginShopsInstance shareInstance].arrShops.count == 1){
if([LoginShopsInstance shareInstance].arrShops.count == 1){
self.topView.buttonName.userInteractionEnabled = NO;
self.shop = [LoginShopsInstance shareInstance].arrShops[0];
[self setUpData];
}
[self.topView setShopName:self.shop.name];
if ([[VankeCommonModel sharedInstance] curUserIsStore]) {
NSLog(@"store");
self.authorizedOrg = [[VankeCommonModel sharedInstance] getAuthOrgs][0];
}else if(self.authorizedOrg == nil){
// ChooseProjectTableViewController *chooseVC = [[ChooseProjectTableViewController alloc] init];
// chooseVC.arrAuthorized = [[VankeCommonModel sharedInstance] getAuthOrgs];
// [self.navigationController addChildViewController:chooseVC];
//
// UIView *chooseView = chooseVC.view;
// chooseView.frame = CGRectMake(20, 50, SCREEN_WIDTH - 40, SCREEN_HEIGHT - 100);
//
// [self.view addSubview:chooseView];
if (self.shop == nil) {
[self.topView setShopName:@""];
}else{
[self.topView setShopName:[NSString stringWithFormat:@"%@【%@】", self.shop.name, self.shop.code]];
}
[self getTodayTotalAmount];
}
......@@ -154,6 +145,7 @@ ON_WILL_APPEAR( signal )
topView.frame = CGRectMake(0, 0, SCREEN_WIDTH, 125 + 64);
self.topView = topView;
topView.textfieldDate.inputView = self.datePicker;
topView.textfieldDate.delegate = self;
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy-MM-dd"];
......@@ -171,6 +163,10 @@ ON_WILL_APPEAR( signal )
}
- (void)textFieldDidEndEditing:(UITextField *)textField {
[self getTodayTotalAmount];
}
- (void)setUpTotalView {
self.totalView = [self viewWithNibName:@"SalesInputTotalView"];
......@@ -212,34 +208,43 @@ ON_WILL_APPEAR( signal )
}
- (void)getTodayTotalAmount {
WS(weakSelf)
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
// NSDate *endDate = [f dateFromString:self.topView.endDate.text];
NSDate *today = [NSDate date];
NSString *startStr = [f stringFromDate:today];
NSDate *tomorrow = [NSDate dateWithTimeInterval:60 * 60 * 24 sinceDate:[NSDate date]];
NSString *endStr = [f stringFromDate:tomorrow];
NSDictionary *params = @{@"shopCodeEquals" : self.shop.code,
@"beginDateEquals" : startStr,
@"endDateEquals" : endStr,
@"pageNumber" : @0,
@"pageSize" : @0};
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl getUrl:@"salesinput/query" params:params success:^(id data) {
NSNumber *amount = data[@"data"][@"records"][0][@"amount"];
NSString *amountStr = [NSString stringWithFormat:@"%.0f", [amount floatValue]];
if (self.shop == nil) {
weakSelf.totalView.labelTotalAmount.text = amountStr;
}else{
NSLog(@"d");
} failure:^(id data) {
[self.cellDataDic removeAllObjects];
[self.tableView reloadData];
WS(weakSelf)
NSDictionary *params = @{@"shopCodeEquals" : self.shop.code,
@"beginDateEquals" : self.topView.textfieldDate.text,
@"endDateEquals" : self.topView.textfieldDate.text,
@"pageNumber" : @0,
@"pageSize" : @0};
}];
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
[httpCtrl getUrl:@"salesinput/query" params:params success:^(id data) {
if ([data[@"data"][@"records"] count] > 0) {
NSNumber *amount = data[@"data"][@"records"][0][@"amount"];
NSString *amountStr = [NSString stringWithFormat:@"%.0f", [amount floatValue]];
weakSelf.todayTotalAmount = amountStr;
weakSelf.totalView.labelTotalAmount.text = amountStr;
}else{
weakSelf.todayTotalAmount = @"0";
weakSelf.totalView.labelTotalAmount.text = @"0";
}
[weakSelf countTotalMonney];
NSLog(@"d");
} failure:^(id data) {
}];
}
}
......@@ -262,16 +267,15 @@ ON_WILL_APPEAR( signal )
CGFloat monney = [array[0] floatValue];
count = count + monney;
}
self.totalView.labelTotal.text = [NSString stringWithFormat:@"%.0f",count];
self.totalView.labelTotalAmount.text = [NSString stringWithFormat:@"%.0f", count + [self.todayTotalAmount floatValue]];
self.totalView.labelTotalAmount.text = [NSString stringWithFormat:@"%.0f", count + [self.totalView.labelTotalAmount.text floatValue]];
}
- (id)viewWithNibName:(NSString *)viewName {
NSArray* nibView = [[NSBundle mainBundle] loadNibNamed:viewName owner:nil options:nil];
return [nibView objectAtIndex:0];
......@@ -316,21 +320,25 @@ ON_WILL_APPEAR( signal )
}
- (void)submit {
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
NSDictionary *params = [self getParams];
NSString *url = [NSString stringWithFormat:@"salesinput/submit?time=%@&operId=%@&operName=%@",[[NSDate date] httpParameterString], [[[VankeCommonModel sharedInstance] getLoginInfo] user_uuid], [[[VankeCommonModel sharedInstance] getLoginInfo] user_name]];
NSString *utf8String = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
WS(weakSelf)
[httpCtrl postUrl:utf8String params:params success:^(id data) {
if (self.shop == nil) {
[weakSelf goToHistory];
}else{
} failure:^(id data) {
ICRHTTPController *httpCtrl = [ICRHTTPController sharedController];
NSDictionary *params = [self getParams];
}];
NSString *url = [NSString stringWithFormat:@"salesinput/submit?time=%@&operId=%@&operName=%@",[[NSDate date] httpParameterString], [[[VankeCommonModel sharedInstance] getLoginInfo] user_uuid], [[[VankeCommonModel sharedInstance] getLoginInfo] user_name]];
NSString *utf8String = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
WS(weakSelf)
[httpCtrl postUrl:utf8String params:params success:^(id data) {
[weakSelf goToHistory];
} failure:^(id data) {
}];
}
}
......
......@@ -10,6 +10,10 @@
@implementation SalesInputCommitView
- (void)awakeFromNib {
self.buttonCommit.layer.cornerRadius = 8;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
......@@ -57,8 +57,8 @@
<constraint firstItem="qWe-Q2-slF" firstAttribute="leading" secondItem="kPx-jb-maY" secondAttribute="leading" constant="10" id="tXQ-lW-a71"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S1O-1V-wvJ">
<rect key="frame" x="334" y="50" width="0.0" height="0.0"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="S1O-1V-wvJ">
<rect key="frame" x="274" y="50" width="18" height="34"/>
<fontDescription key="fontDescription" type="system" pointSize="28"/>
<color key="textColor" red="0.92941176470588238" green="0.10588235294117647" blue="0.13725490196078433" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......
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