//
//  AppDelegate.h
//  RedAnt ERP Suite
//
//  Created by Ray on 14-5-19.
//  Copyright (c) 2014年 United Software Applications, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "iSalesDB.h"
#import "ScanApiHelper.h"
//#import "MainViewController.h"
#import "ActiveViewController.h"
#import "SyncControlPanelViewController.h"


@interface AppDelegate : UIResponder <UIApplicationDelegate,ScanApiHelperDelegate , NSURLConnectionDataDelegate>

@property (strong, nonatomic) UIWindow *window;
@property (strong,nonatomic) NSString* user;
@property (strong,nonatomic) NSString * password;
@property (strong,nonatomic) NSString * user_icon;
//@property (strong,nonatomic) NSString * sessionid;
@property (strong,nonatomic) NSString * duid;
@property bool bLogin;
@property bool bEnable_Cache;
@property long user_type;
@property (strong , nonatomic) NSString* contact_id;


@property (strong , nonatomic) NSString* order_customer_id;
//@property (strong , nonatomic) NSString* contact_name;
@property (strong,nonatomic)NSDictionary* categoryMenu;

@property (strong,nonatomic)UIViewController* active_controller;

@property (strong,nonatomic)NSMutableDictionary* customerInfo;
@property (strong,nonatomic)NSMutableDictionary* recent_model;

@property (strong,nonatomic) NSString* order_code;
@property  int order_status;
//@property (strong,nonatomic) NSString* so;
@property (strong,nonatomic) UIViewController* main_vc;

@property (strong,nonatomic) NSString* build;
-(void) Logout;
-(void) SetMode:(NSString*)mode;
@property (strong,nonatomic) NSString* mode;
-(void) SetSo:(NSString*)So;

-(void) switchToPreviousVC;

-(void) closeOrder;

@property long wish_count;
@property long cart_count;
@property long port_count;

@property bool offline_mode;

@property bool can_show_price;
@property bool can_see_price;
@property bool can_create_portfolio;
@property bool can_cancel_order;
@property bool can_set_cart_price;
@property bool can_create_order;
@property bool can_delete_order;
@property bool can_submit_order;
@property bool can_set_tearsheet_price;
@property bool can_update_contact_info;
@property bool submit_order_logout;
@property bool save_order_logout;
@property bool alert_sold_in_quantities;
@property(readonly) bool price_hidden;


-(void) set_priceHidden:(bool)price_hidden;

-(void) set_main_button_panel;

//@property bool can_show_price;
//@property bool can_show_price;
//@property bool can_show_price;

@property (strong , nonatomic) NSString* ipad_perm;

-(void) update_count_mark;
// downloader
-(void) check_offline:(NSString*) ver useInternalAddress:(bool)buseinternaladdress parentvc:(UIViewController*) parent;
@property bool disable_trigger;

@property (nonatomic, strong) SyncControlPanelViewController *settingUI;
@property (nonatomic, strong) NSFileHandle *fileHandle;
//@property (nonatomic, assign) long long currentLength; //>>写入文件的长度
//@property (nonatomic, assign) long long fileLength; //>>文件长度
//@property (nonatomic, strong) NSString *fileName;   //>>文件名
@property (nonatomic, strong) NSURLConnection *connection;
@property double file_progress;
@property double overall_progress;
@property (strong, nonatomic) NSString* downloadlog;
@property (strong, nonatomic) NSString* vid;
@property bool downloading;
-(void) add_downloadlog:(NSString*) newtext;
@property (strong, nonatomic) NSMutableDictionary* download_task;
@property int current_task;
//scanner
#define API_START 1
#define API_STOP 3
#define API_INIT 0
#define API_CLOSING 2


@property (strong, nonatomic) ScanApiHelper* ScanApi;
@property (strong, nonatomic) NSTimer* ScanApiConsumer;
@property (nonatomic) BOOL doAppDataConfirmation;
@property (strong, nonatomic) NSString *scanApiVersion;
@property (strong, nonatomic) NSString* log;
@property BOOL softScannerEnabled;
-(void) addlog:(NSString*) newtext;
@property bool enable_ScannerLog;
@property (strong,nonatomic) NSMutableArray* devices;
- (void)enableScanner:(bool)enable ;
@property int api_Status;
@property (strong, nonatomic) NSString* Status_Text;

-(void) didRotated;

// scanner test
-(void) test_onDecodedDataResult:(NSString*) value;

// printer

@property (strong, nonatomic) NSString * printerURL;
-(void) printPdf:(NSString*) url company:(NSString*)company send_to:(NSString*)send_to soid:(NSString*)soid content:(NSString*)content;
@property (strong, nonatomic) NSMutableDictionary* OrderFilter;

@property (nonatomic,strong) NSMutableDictionary *urgencyDic;///<程序闪退需要保存的数据

@end
