From 76416662e42aba29ad1faa72f8b96e3fbb531f9a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=99=88=E4=BF=8A=E4=BF=8A?= <857899254@qq.com>
Date: Sun, 23 Aug 2015 17:28:15 +0800
Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 XFFruit.xcodeproj/project.pbxproj             | 151 ++++++----
 .../ICRDataBaseController.m                   |   3 +-
 .../HTTPController/ICRHTTPController.h        |   6 +
 .../HTTPController/ICRHTTPController.m        |  70 ++++-
 .../Survey/edit.imageset/Contents.json        |  22 ++
 .../Survey/edit.imageset/edit.png             | Bin 0 -> 3190 bytes
 .../Survey/edit.imageset/edit@2x.png          | Bin 0 -> 3258 bytes
 .../Business/BusinessViewController.m         |  20 ++
 .../Controllers/ChooseVendorViewController.h  |  15 +
 .../Controllers/ChooseVendorViewController.m  | 257 ++++++++++++++++++
 .../Controllers/NewPurchaseViewController.h   |   0
 .../Controllers/NewPurchaseViewController.m   |  12 +-
 .../Controllers/ProductViewController.h       |   1 +
 .../Controllers/ProductViewController.m       |  26 +-
 .../PurchaseDetailViewController.h            |  15 +
 .../PurchaseDetailViewController.m            | 186 +++++++++++++
 .../Controllers/PurchaseViewController.h      |  13 +
 .../Controllers/PurchaseViewController.m      | 152 +++++++++++
 .../Purchase/Models/PurchaseBill.h            |  36 +++
 .../Purchase/Models/PurchaseBill.m            |  13 +
 .../ViewControllers/Purchase/Models/Vendor.h  |  18 ++
 .../ViewControllers/Purchase/Models/Vendor.m  |  19 ++
 .../Views/ProductCell.h                       |   2 +-
 .../Views/ProductCell.m                       |  34 +--
 .../Purchase/Views/PurchaseCell.h             |  22 ++
 .../Purchase/Views/PurchaseCell.m             | 115 ++++++++
 .../Views/TopPurchaseView.h                   |   2 +-
 .../Views/TopPurchaseView.m                   |  20 +-
 .../controllers/NewSurveyViewController.m     |   2 +-
 .../controllers/SurveyDetailViewController.m  |  15 +-
 .../Survey/controllers/SurveyViewController.m |   1 -
 31 files changed, 1137 insertions(+), 111 deletions(-)
 create mode 100644 XFFruit/Images.xcassets/Survey/edit.imageset/Contents.json
 create mode 100644 XFFruit/Images.xcassets/Survey/edit.imageset/edit.png
 create mode 100644 XFFruit/Images.xcassets/Survey/edit.imageset/edit@2x.png
 create mode 100644 XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.h
 create mode 100644 XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.m
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Controllers/NewPurchaseViewController.h (100%)
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Controllers/NewPurchaseViewController.m (92%)
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Controllers/ProductViewController.h (89%)
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Controllers/ProductViewController.m (87%)
 create mode 100644 XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.h
 create mode 100644 XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.m
 create mode 100644 XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.h
 create mode 100644 XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.m
 create mode 100644 XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
 create mode 100644 XFFruit/ViewControllers/Purchase/Models/PurchaseBill.m
 create mode 100644 XFFruit/ViewControllers/Purchase/Models/Vendor.h
 create mode 100644 XFFruit/ViewControllers/Purchase/Models/Vendor.m
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Views/ProductCell.h (94%)
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Views/ProductCell.m (86%)
 create mode 100644 XFFruit/ViewControllers/Purchase/Views/PurchaseCell.h
 create mode 100644 XFFruit/ViewControllers/Purchase/Views/PurchaseCell.m
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Views/TopPurchaseView.h (95%)
 rename XFFruit/ViewControllers/{Survey/controllers => Purchase}/Views/TopPurchaseView.m (87%)

diff --git a/XFFruit.xcodeproj/project.pbxproj b/XFFruit.xcodeproj/project.pbxproj
index 936e283..9c0c6e6 100644
--- a/XFFruit.xcodeproj/project.pbxproj
+++ b/XFFruit.xcodeproj/project.pbxproj
@@ -65,6 +65,16 @@
 		7217E9F31B72364300FE5C1D /* SurveyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E11B72364300FE5C1D /* SurveyCell.m */; };
 		7217E9F41B72364300FE5C1D /* SurveyListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7217E9E31B72364300FE5C1D /* SurveyListCell.m */; };
 		7217E9F61B724A7600FE5C1D /* mask.png in Resources */ = {isa = PBXBuildFile; fileRef = 7217E9F51B724A7600FE5C1D /* mask.png */; };
+		7281A0B31B8974120052B1AC /* NewPurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */; };
+		7281A0B41B8974120052B1AC /* ProductViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0AC1B8974120052B1AC /* ProductViewController.m */; };
+		7281A0B51B8974120052B1AC /* ProductCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B01B8974120052B1AC /* ProductCell.m */; };
+		7281A0B61B8974120052B1AC /* TopPurchaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B21B8974120052B1AC /* TopPurchaseView.m */; };
+		7281A0B91B897BB20052B1AC /* PurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0B81B897BB20052B1AC /* PurchaseViewController.m */; };
+		7281A0BC1B897EAB0052B1AC /* PurchaseCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0BB1B897EAB0052B1AC /* PurchaseCell.m */; };
+		7281A0BF1B8980E60052B1AC /* PurchaseBill.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0BE1B8980E60052B1AC /* PurchaseBill.m */; };
+		7281A0C21B898A040052B1AC /* PurchaseDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0C11B898A040052B1AC /* PurchaseDetailViewController.m */; };
+		7281A0C51B89BF1C0052B1AC /* ChooseVendorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0C41B89BF1C0052B1AC /* ChooseVendorViewController.m */; };
+		7281A0C81B89BFE60052B1AC /* Vendor.m in Sources */ = {isa = PBXBuildFile; fileRef = 7281A0C71B89BFE60052B1AC /* Vendor.m */; };
 		72C8034C1B7B72DB00990363 /* AddWorkSheetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 72C8034B1B7B72DB00990363 /* AddWorkSheetViewController.m */; };
 		72C8034F1B7B735300990363 /* TopSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 72C8034E1B7B735300990363 /* TopSheetView.m */; };
 		72C803521B7B897B00990363 /* DataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 72C803511B7B897B00990363 /* DataManager.m */; };
@@ -357,10 +367,6 @@
 		FE2FCC8B1B74A9EE00BBC6FB /* SurveyResultCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE2FCC8A1B74A9EE00BBC6FB /* SurveyResultCell.m */; };
 		FE4F17251B72FAAB00924DED /* ChosePersonViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */; };
 		FE7155D91B7B328400595B0A /* Product.m in Sources */ = {isa = PBXBuildFile; fileRef = FE7155D81B7B328400595B0A /* Product.m */; };
-		FE9163C71B86F643007D6ECF /* NewPurchaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9163C61B86F643007D6ECF /* NewPurchaseViewController.m */; };
-		FE9163CA1B86F87E007D6ECF /* TopPurchaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9163C91B86F87E007D6ECF /* TopPurchaseView.m */; };
-		FE9163CD1B8701E6007D6ECF /* ProductViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9163CC1B8701E6007D6ECF /* ProductViewController.m */; };
-		FE9163D01B87041C007D6ECF /* ProductCell.m in Sources */ = {isa = PBXBuildFile; fileRef = FE9163CF1B87041C007D6ECF /* ProductCell.m */; };
 		FEA2F2FD1B8423B900D64735 /* BottomSheetView.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */; };
 		FEA2F3001B842A1C00D64735 /* MaterialVIewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F2FF1B842A1C00D64735 /* MaterialVIewController.m */; };
 		FEA2F3031B8453C700D64735 /* GoodsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = FEA2F3021B8453C700D64735 /* GoodsViewController.m */; };
@@ -460,6 +466,26 @@
 		7217E9E21B72364300FE5C1D /* SurveyListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SurveyListCell.h; sourceTree = "<group>"; };
 		7217E9E31B72364300FE5C1D /* SurveyListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SurveyListCell.m; sourceTree = "<group>"; };
 		7217E9F51B724A7600FE5C1D /* mask.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mask.png; sourceTree = "<group>"; };
+		7281A0A91B8974120052B1AC /* NewPurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewPurchaseViewController.h; sourceTree = "<group>"; };
+		7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewPurchaseViewController.m; sourceTree = "<group>"; };
+		7281A0AB1B8974120052B1AC /* ProductViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductViewController.h; sourceTree = "<group>"; };
+		7281A0AC1B8974120052B1AC /* ProductViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductViewController.m; sourceTree = "<group>"; };
+		7281A0AF1B8974120052B1AC /* ProductCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductCell.h; sourceTree = "<group>"; };
+		7281A0B01B8974120052B1AC /* ProductCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductCell.m; sourceTree = "<group>"; };
+		7281A0B11B8974120052B1AC /* TopPurchaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopPurchaseView.h; sourceTree = "<group>"; };
+		7281A0B21B8974120052B1AC /* TopPurchaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopPurchaseView.m; sourceTree = "<group>"; };
+		7281A0B71B897BB20052B1AC /* PurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseViewController.h; sourceTree = "<group>"; };
+		7281A0B81B897BB20052B1AC /* PurchaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseViewController.m; sourceTree = "<group>"; };
+		7281A0BA1B897EAB0052B1AC /* PurchaseCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseCell.h; sourceTree = "<group>"; };
+		7281A0BB1B897EAB0052B1AC /* PurchaseCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseCell.m; sourceTree = "<group>"; };
+		7281A0BD1B8980E60052B1AC /* PurchaseBill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseBill.h; sourceTree = "<group>"; };
+		7281A0BE1B8980E60052B1AC /* PurchaseBill.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseBill.m; sourceTree = "<group>"; };
+		7281A0C01B898A040052B1AC /* PurchaseDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PurchaseDetailViewController.h; sourceTree = "<group>"; };
+		7281A0C11B898A040052B1AC /* PurchaseDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PurchaseDetailViewController.m; sourceTree = "<group>"; };
+		7281A0C31B89BF1C0052B1AC /* ChooseVendorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChooseVendorViewController.h; sourceTree = "<group>"; };
+		7281A0C41B89BF1C0052B1AC /* ChooseVendorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChooseVendorViewController.m; sourceTree = "<group>"; };
+		7281A0C61B89BFE60052B1AC /* Vendor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vendor.h; sourceTree = "<group>"; };
+		7281A0C71B89BFE60052B1AC /* Vendor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Vendor.m; sourceTree = "<group>"; };
 		72C8034A1B7B72DB00990363 /* AddWorkSheetViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddWorkSheetViewController.h; sourceTree = "<group>"; };
 		72C8034B1B7B72DB00990363 /* AddWorkSheetViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddWorkSheetViewController.m; sourceTree = "<group>"; };
 		72C8034D1B7B735300990363 /* TopSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopSheetView.h; sourceTree = "<group>"; };
@@ -779,14 +805,6 @@
 		FE4F17241B72FAAB00924DED /* ChosePersonViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChosePersonViewController.m; sourceTree = "<group>"; };
 		FE7155D71B7B328400595B0A /* Product.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Product.h; sourceTree = "<group>"; };
 		FE7155D81B7B328400595B0A /* Product.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Product.m; sourceTree = "<group>"; };
-		FE9163C51B86F643007D6ECF /* NewPurchaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NewPurchaseViewController.h; sourceTree = "<group>"; };
-		FE9163C61B86F643007D6ECF /* NewPurchaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewPurchaseViewController.m; sourceTree = "<group>"; };
-		FE9163C81B86F87E007D6ECF /* TopPurchaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopPurchaseView.h; sourceTree = "<group>"; };
-		FE9163C91B86F87E007D6ECF /* TopPurchaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopPurchaseView.m; sourceTree = "<group>"; };
-		FE9163CB1B8701E6007D6ECF /* ProductViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductViewController.h; sourceTree = "<group>"; };
-		FE9163CC1B8701E6007D6ECF /* ProductViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductViewController.m; sourceTree = "<group>"; };
-		FE9163CE1B87041C007D6ECF /* ProductCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProductCell.h; sourceTree = "<group>"; };
-		FE9163CF1B87041C007D6ECF /* ProductCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProductCell.m; sourceTree = "<group>"; };
 		FEA2F2FB1B8423B900D64735 /* BottomSheetView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomSheetView.h; sourceTree = "<group>"; };
 		FEA2F2FC1B8423B900D64735 /* BottomSheetView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BottomSheetView.m; sourceTree = "<group>"; };
 		FEA2F2FE1B842A1C00D64735 /* MaterialVIewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MaterialVIewController.h; sourceTree = "<group>"; };
@@ -948,6 +966,57 @@
 			path = GrowingTextView;
 			sourceTree = "<group>";
 		};
+		7281A0A71B8974120052B1AC /* Purchase */ = {
+			isa = PBXGroup;
+			children = (
+				7281A0A81B8974120052B1AC /* Controllers */,
+				7281A0AD1B8974120052B1AC /* Models */,
+				7281A0AE1B8974120052B1AC /* Views */,
+			);
+			path = Purchase;
+			sourceTree = "<group>";
+		};
+		7281A0A81B8974120052B1AC /* Controllers */ = {
+			isa = PBXGroup;
+			children = (
+				7281A0A91B8974120052B1AC /* NewPurchaseViewController.h */,
+				7281A0AA1B8974120052B1AC /* NewPurchaseViewController.m */,
+				7281A0AB1B8974120052B1AC /* ProductViewController.h */,
+				7281A0AC1B8974120052B1AC /* ProductViewController.m */,
+				7281A0B71B897BB20052B1AC /* PurchaseViewController.h */,
+				7281A0B81B897BB20052B1AC /* PurchaseViewController.m */,
+				7281A0C01B898A040052B1AC /* PurchaseDetailViewController.h */,
+				7281A0C11B898A040052B1AC /* PurchaseDetailViewController.m */,
+				7281A0C31B89BF1C0052B1AC /* ChooseVendorViewController.h */,
+				7281A0C41B89BF1C0052B1AC /* ChooseVendorViewController.m */,
+			);
+			path = Controllers;
+			sourceTree = "<group>";
+		};
+		7281A0AD1B8974120052B1AC /* Models */ = {
+			isa = PBXGroup;
+			children = (
+				7281A0BD1B8980E60052B1AC /* PurchaseBill.h */,
+				7281A0BE1B8980E60052B1AC /* PurchaseBill.m */,
+				7281A0C61B89BFE60052B1AC /* Vendor.h */,
+				7281A0C71B89BFE60052B1AC /* Vendor.m */,
+			);
+			path = Models;
+			sourceTree = "<group>";
+		};
+		7281A0AE1B8974120052B1AC /* Views */ = {
+			isa = PBXGroup;
+			children = (
+				7281A0AF1B8974120052B1AC /* ProductCell.h */,
+				7281A0B01B8974120052B1AC /* ProductCell.m */,
+				7281A0B11B8974120052B1AC /* TopPurchaseView.h */,
+				7281A0B21B8974120052B1AC /* TopPurchaseView.m */,
+				7281A0BA1B897EAB0052B1AC /* PurchaseCell.h */,
+				7281A0BB1B897EAB0052B1AC /* PurchaseCell.m */,
+			);
+			path = Views;
+			sourceTree = "<group>";
+		};
 		72C803431B7B6F0200990363 /* WorkSheet */ = {
 			isa = PBXGroup;
 			children = (
@@ -1640,7 +1709,7 @@
 		C1C6FEED1AB88A3400D4C41A /* ViewControllers */ = {
 			isa = PBXGroup;
 			children = (
-				FE9163C11B86F46C007D6ECF /* Purchase */,
+				7281A0A71B8974120052B1AC /* Purchase */,
 				FE17F67A1B85CA5B0078CE96 /* PurchaseNotice */,
 				72C803431B7B6F0200990363 /* WorkSheet */,
 				7217E9C01B72364300FE5C1D /* Survey */,
@@ -1862,48 +1931,6 @@
 			path = PurchaseNotice;
 			sourceTree = "<group>";
 		};
-		FE9163C11B86F46C007D6ECF /* Purchase */ = {
-			isa = PBXGroup;
-			children = (
-				FE9163C21B86F4A5007D6ECF /* Controllers */,
-				FE9163C31B86F4A5007D6ECF /* Models */,
-				FE9163C41B86F4A5007D6ECF /* Views */,
-			);
-			path = Purchase;
-			sourceTree = "<group>";
-		};
-		FE9163C21B86F4A5007D6ECF /* Controllers */ = {
-			isa = PBXGroup;
-			children = (
-				FE9163C51B86F643007D6ECF /* NewPurchaseViewController.h */,
-				FE9163C61B86F643007D6ECF /* NewPurchaseViewController.m */,
-				FE9163CB1B8701E6007D6ECF /* ProductViewController.h */,
-				FE9163CC1B8701E6007D6ECF /* ProductViewController.m */,
-			);
-			name = Controllers;
-			path = ../Survey/controllers/Controllers;
-			sourceTree = "<group>";
-		};
-		FE9163C31B86F4A5007D6ECF /* Models */ = {
-			isa = PBXGroup;
-			children = (
-			);
-			name = Models;
-			path = ../Survey/controllers/Models;
-			sourceTree = "<group>";
-		};
-		FE9163C41B86F4A5007D6ECF /* Views */ = {
-			isa = PBXGroup;
-			children = (
-				FE9163C81B86F87E007D6ECF /* TopPurchaseView.h */,
-				FE9163C91B86F87E007D6ECF /* TopPurchaseView.m */,
-				FE9163CE1B87041C007D6ECF /* ProductCell.h */,
-				FE9163CF1B87041C007D6ECF /* ProductCell.m */,
-			);
-			name = Views;
-			path = ../Survey/controllers/Views;
-			sourceTree = "<group>";
-		};
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
@@ -2073,8 +2100,8 @@
 				7217E9EC1B72364300FE5C1D /* HPTextViewInternal.m in Sources */,
 				C159184B1AC062460013B391 /* IBTTabBarController.m in Sources */,
 				C142D2BE1AC3A155000109A7 /* UIView+FindUIViewController.m in Sources */,
-				FE9163CD1B8701E6007D6ECF /* ProductViewController.m in Sources */,
 				35C3C0BF1AE95F1D0035AC8A /* UIImage+Rotate.m in Sources */,
+				7281A0C51B89BF1C0052B1AC /* ChooseVendorViewController.m in Sources */,
 				C11A344D1B1BE27200079129 /* ICRPatrolAllStoreViewController.m in Sources */,
 				C10214DD1AD90A3F0024637E /* ICRFunctionEntity.m in Sources */,
 				FE17F6831B85CA5B0078CE96 /* NewPurchaseNoticeViewController.m in Sources */,
@@ -2102,6 +2129,7 @@
 				C15918511AC062460013B391 /* IBTUILabel.m in Sources */,
 				04040E001B6FE75800326D12 /* ICRPerson.m in Sources */,
 				C159183F1AC062460013B391 /* IBTTableViewInfo.m in Sources */,
+				7281A0BC1B897EAB0052B1AC /* PurchaseCell.m in Sources */,
 				C11A34661B24487D00079129 /* ICRAnswer.m in Sources */,
 				C1D017171AD8EF8100CD9CB8 /* IBTSegmentedControl.m in Sources */,
 				C10C90901AE54FE300B911CD /* IBTDatePickerViewController.m in Sources */,
@@ -2110,6 +2138,7 @@
 				C18AEA881AC8D31000A1DB7B /* IBTUIView.m in Sources */,
 				C1FE50501AE024FA00C18080 /* UIActionSheet+Blocks.m in Sources */,
 				C123A92B1B26EDDA003C0C36 /* ICRQuestionHelperView.m in Sources */,
+				7281A0BF1B8980E60052B1AC /* PurchaseBill.m in Sources */,
 				7217E9EB1B72364300FE5C1D /* HPGrowingTextView.m in Sources */,
 				72C803521B7B897B00990363 /* DataManager.m in Sources */,
 				C1C5643E1AD62BD8006A1050 /* ICRPlaceholderTextView.m in Sources */,
@@ -2147,10 +2176,11 @@
 				C1B810AD1ADF4D6A00BBC75A /* ICRAttachmentView.m in Sources */,
 				C15295C71B2451E900DF60D1 /* ICRQStarViewController.m in Sources */,
 				C15295D01B24741400DF60D1 /* ASValueTrackingSlider.m in Sources */,
+				7281A0B61B8974120052B1AC /* TopPurchaseView.m in Sources */,
 				C1E9F5731B2E411900BF1356 /* IBTFileManager.m in Sources */,
 				C15295B71B24450A00DF60D1 /* ICRQAViewController.m in Sources */,
 				30D7FE5D1AD4F941003D92EE /* ICRAboutViewController.m in Sources */,
-				FE9163C71B86F643007D6ECF /* NewPurchaseViewController.m in Sources */,
+				7281A0B31B8974120052B1AC /* NewPurchaseViewController.m in Sources */,
 				C10214DF1AD90A3F0024637E /* ICRFunctionItemControl.m in Sources */,
 				C15918431AC062460013B391 /* IBTTableViewUserInfo.m in Sources */,
 				30D702461ADE3862008DC0BF /* ICRAnnouncementDetailHeadView.m in Sources */,
@@ -2193,6 +2223,7 @@
 				300DD94E1B184EA70080EE12 /* ICRQuestion.m in Sources */,
 				7217E9E81B72364300FE5C1D /* Survey.m in Sources */,
 				FEAE16EC1B79CAA0009D9E01 /* TPCustomImageVIew.m in Sources */,
+				7281A0B51B8974120052B1AC /* ProductCell.m in Sources */,
 				C1FE50561AE3587F00C18080 /* ICRAttachmentUnit.m in Sources */,
 				30D7494C1ACE340D00C63BA1 /* ICRModifyPwdViewController.m in Sources */,
 				C10214CD1AD8FE200024637E /* ICRStoreDetailViewController.m in Sources */,
@@ -2209,14 +2240,14 @@
 				C18AEA8C1AC9855400A1DB7B /* IBTLoadingView.m in Sources */,
 				C10C90A11AE5751D00B911CD /* ICRPost.m in Sources */,
 				7217E9F21B72364300FE5C1D /* StartTimeView.m in Sources */,
-				FE9163CA1B86F87E007D6ECF /* TopPurchaseView.m in Sources */,
 				C1FE50351AE020D400C18080 /* IBTAudioController.m in Sources */,
+				7281A0C21B898A040052B1AC /* PurchaseDetailViewController.m in Sources */,
 				FEA2F3061B8453DE00D64735 /* CostViewController.m in Sources */,
 				C14BE3061ADB84350049F1AA /* IBTTextFieldCell.m in Sources */,
 				30F7F5711ADE723100A9B24E /* ICRAttachmentCellContentView.m in Sources */,
 				C15918451AC062460013B391 /* IBTBadgeView.m in Sources */,
+				7281A0C81B89BFE60052B1AC /* Vendor.m in Sources */,
 				C15295C31B2451AC00DF60D1 /* ICRQReseachViewController.m in Sources */,
-				FE9163D01B87041C007D6ECF /* ProductCell.m in Sources */,
 				C15918531AC062460013B391 /* IBTUINavigationController.m in Sources */,
 				C11A346F1B247BDB00079129 /* ICRAnswerDetail.m in Sources */,
 				C1ADF7411ACE6EFD007258A8 /* UIViewController+LogicController.m in Sources */,
@@ -2227,6 +2258,7 @@
 				C1E108591ADA53C700620375 /* ICRTaskResultViewController.m in Sources */,
 				FEAE16EF1B79CAE3009D9E01 /* SingleScrollView.m in Sources */,
 				C10C909D1AE56E8700B911CD /* JTOptionsViewController.m in Sources */,
+				7281A0B91B897BB20052B1AC /* PurchaseViewController.m in Sources */,
 				C1C5644F1AD6719B006A1050 /* ICRTaskDetailViewController.m in Sources */,
 				C1E1085D1ADA577500620375 /* ICRTaskDetailContentView.m in Sources */,
 				C14BE30E1ADB86DB0049F1AA /* NSData+EncodeAdditions.m in Sources */,
@@ -2236,6 +2268,7 @@
 				C1864A561B0B0D9D00D11C4E /* ICRPostTask.m in Sources */,
 				FE2FCC7F1B74511000BBC6FB /* ChooseProductViewController.m in Sources */,
 				FE2FCC881B7492C500BBC6FB /* ResultDetailViewController.m in Sources */,
+				7281A0B41B8974120052B1AC /* ProductViewController.m in Sources */,
 				C159183D1AC062460013B391 /* IBTTableViewCellInfo.m in Sources */,
 				C1FE504E1AE024FA00C18080 /* RIButtonItem.m in Sources */,
 				C18AEA9A1AD2749200A1DB7B /* ICRStoreListViewController.m in Sources */,
diff --git a/XFFruit/Controllers/DataBaseController/ICRDataBaseController.m b/XFFruit/Controllers/DataBaseController/ICRDataBaseController.m
index bf9463e..f143963 100644
--- a/XFFruit/Controllers/DataBaseController/ICRDataBaseController.m
+++ b/XFFruit/Controllers/DataBaseController/ICRDataBaseController.m
@@ -23,6 +23,7 @@
 #import "Product.h"
 #import "User.h"
 #import "Survey.h"
+#import "Vendor.h"
 
 #define ICR_DB_ERROR_PARAMETER              @"Parse Error: Bad Parameter(s)"
 
@@ -94,7 +95,7 @@ static NSString *ICRDataBasePath = @"";
     [_m_dbQueue inDatabase:^(FMDatabase *db) {
         
         NSArray *tableNameArr =
-        @[ [Product class],[User class],[Survey class]];
+        @[ [Product class],[User class],[Survey class],[Vendor class]];
         
         NSMutableArray *sqlBatch = [NSMutableArray array];
         NSString *sql = nil;
diff --git a/XFFruit/Controllers/HTTPController/ICRHTTPController.h b/XFFruit/Controllers/HTTPController/ICRHTTPController.h
index c2b93e6..04a6114 100644
--- a/XFFruit/Controllers/HTTPController/ICRHTTPController.h
+++ b/XFFruit/Controllers/HTTPController/ICRHTTPController.h
@@ -220,6 +220,12 @@ typedef NS_ENUM(NSUInteger, ICRAttachmentType) {
                      success:(void (^)(id))succ
                      failure:(void (^)(id))fail;
 
+//供应商
+- (void)getVendorWithPage_number:(NSUInteger)page_number
+                        page_size:(NSUInteger)page_size
+                          success:(void (^)(id))succ
+                          failure:(void (^)(id))fail;
+
 @end
 
 
diff --git a/XFFruit/Controllers/HTTPController/ICRHTTPController.m b/XFFruit/Controllers/HTTPController/ICRHTTPController.m
index d162d82..a647526 100644
--- a/XFFruit/Controllers/HTTPController/ICRHTTPController.m
+++ b/XFFruit/Controllers/HTTPController/ICRHTTPController.m
@@ -75,7 +75,9 @@ typedef NS_ENUM(NSUInteger, ICRHTTPAction) {
     XFFHttp_SurveyFinish,
     //行情反馈图片
     XFFHttp_ResultChart,
-    XFFHttp_GetResults
+    XFFHttp_GetResults,
+    //供应商
+    XFFHttp_GetVendor
 };
 
 static NSString * const ICRHTTPInterface[] = {
@@ -131,7 +133,8 @@ static NSString * const ICRHTTPInterface[] = {
     [XFFHttp_SurveyFinish]                  = @"survey/finish",
     //行情反馈生成图片
     [XFFHttp_ResultChart]                   = @"survey/resultchart",
-    [XFFHttp_GetResults]                   = @"survey/get_results"
+    [XFFHttp_GetResults]                   = @"survey/get_results",
+    [XFFHttp_GetVendor]                     = @"mdata/vendor/download"
 };
 
 static NSString * const ICRAttachmentTypeValue[] = {
@@ -1416,14 +1419,15 @@ acceptTypeJson:YES
                     }];
                 }
             };
-            
-            ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
-            [dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
-                        objectClass:NSClassFromString( @"Product" )
-                        deleteLocal:YES
-                         handleData:NULL
-                           complete:complete
-                               fail:fail];
+            if (responseObject) {
+                ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
+                [dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
+                            objectClass:NSClassFromString( @"Product" )
+                            deleteLocal:YES
+                             handleData:NULL
+                               complete:complete
+                                   fail:fail];
+            }
         }
         else {
             if (fail) {
@@ -1602,6 +1606,52 @@ acceptTypeJson:YES
        failure:failure];
 
 }
+//供应商
+-(void)getVendorWithPage_number:(NSUInteger)page_number
+                       page_size:(NSUInteger)page_size
+                         success:(void (^)(id))succ
+                         failure:(void (^)(id))fail{
+    void (^success)(AFHTTPRequestOperation *operation, id responseObject) = ^(AFHTTPRequestOperation *operation, id responseObject) {
+        CLog(@"%@", responseObject);
+        if (IsDictObject(responseObject)) {
+            void (^complete)(void) = ^(void){
+                if (succ) {
+                    [IBTCommon runOnMainThreadWithoutDeadlocking:^{
+                        succ( responseObject );
+                    }];
+                }
+            };
+            
+            ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
+            [dbCtrl storageEntities:responseObject[ @"data" ][ @"records" ]
+                        objectClass:NSClassFromString( @"Vendor" )
+                        deleteLocal:YES
+                         handleData:NULL
+                           complete:complete
+                               fail:fail];
+        }
+        else {
+            if (fail) {
+                fail( nil );
+            }
+        }
+    };
+    void (^failure)(AFHTTPRequestOperation *operation, NSError *error) = ^(AFHTTPRequestOperation *operation, NSError *error) {
+        CLog(@"%@", error);
+        if (fail) {
+            fail( error );
+        }
+    };
+    
+    NSString *urlStr = [[[self class] UrlForPluginHTTPAction:XFFHttp_GetVendor] stringByAppendingFormat:@"?start_date=%@&page_number=%@&page_size=%@", [[NSDate date] httpParameterString],@(page_number),@(page_size)];
+    NSString *encodeUrlStr = [urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
+    [self POST:encodeUrlStr
+    parameters:NULL
+     needToken:NO
+acceptTypeJson:YES
+       success:success
+       failure:failure];
+}
 
 
 @end
diff --git a/XFFruit/Images.xcassets/Survey/edit.imageset/Contents.json b/XFFruit/Images.xcassets/Survey/edit.imageset/Contents.json
new file mode 100644
index 0000000..aef5312
--- /dev/null
+++ b/XFFruit/Images.xcassets/Survey/edit.imageset/Contents.json
@@ -0,0 +1,22 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x",
+      "filename" : "edit.png"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "2x",
+      "filename" : "edit@2x.png"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}
\ No newline at end of file
diff --git a/XFFruit/Images.xcassets/Survey/edit.imageset/edit.png b/XFFruit/Images.xcassets/Survey/edit.imageset/edit.png
new file mode 100644
index 0000000000000000000000000000000000000000..4509edc7d77aee83c3b48207c6c1ec9a3be483ce
GIT binary patch
literal 3190
zcmV-+42koJP)<h;3K|Lk000e1NJLTq000jF000&U1^@s69}mVE00009a7bBm000XU
z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+<Lqi~Na&Km7Y-Iodc-oy)cUY767Czti
zWe-+D*zmEJY=HnGBdiF>5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1<Rh~l6qxMx9%
zh+2zPTsZC@+^4mDdhhM+``7!t=bY#K&Uw!dfDsZVk>;Xm069{HJUZAPk55R%$-RIA
z6-eL&AQ0xu!e<4=008g<d3b(wus{3(uWtYX0C3eVBofEr|AV?vCRYF;kpSQ#66Xs6
zkWv81E>y@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e
zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5
z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7}
z<RYAxn<EoQ=L1a63;+Nc`O(4tI6si*=H%h#X6J10^u?n7Yw&L(J|Xen{=AF=1OO0D
z&+pn_<>l4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf
zVxhe-<BLB3GvROGi+=X}Kpy_vdhh^onn0PYz@vlxaba$Du2PQY%LGC(ZujRS{>O!X
z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4
ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR
z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+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E
zupuI*y1`X!$J2=TjtAI_(OzIPu$_3FQhJ1adEG9SS@HsdIjoP^8WEFa|Fmjeu^QI@
c4+#GT04)lXnN5E$R{#J207*qoM6N<$f*t@6aR2}S

literal 0
HcmV?d00001

diff --git a/XFFruit/Images.xcassets/Survey/edit.imageset/edit@2x.png b/XFFruit/Images.xcassets/Survey/edit.imageset/edit@2x.png
new file mode 100644
index 0000000000000000000000000000000000000000..b70484de5e3eae099c38d0910bc1272dec937348
GIT binary patch
literal 3258
zcmV;r3`O&aP)<h;3K|Lk000e1NJLTq0015U001or1^@s6x!&8M00009a7bBm000XU
z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+<Lqi~Na&Km7Y-Iodc-oy)cUY767Czti
zWe-+D*zmEJY=HnGBdiF>5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1<Rh~l6qxMx9%
zh+2zPTsZC@+^4mDdhhM+``7!t=bY#K&Uw!dfDsZVk>;Xm069{HJUZAPk55R%$-RIA
z6-eL&AQ0xu!e<4=008g<d3b(wus{3(uWtYX0C3eVBofEr|AV?vCRYF;kpSQ#66Xs6
zkWv81E>y@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e
zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5
z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7}
z<RYAxn<EoQ=L1a63;+Nc`O(4tI6si*=H%h#X6J10^u?n7Yw&L(J|Xen{=AF=1OO0D
z&+pn_<>l4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf
zVxhe-<BLB3GvROGi+=X}Kpy_vdhh^onn0PYz@vlxaba$Du2PQY%LGC(ZujRS{>O!X
z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY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=(?e})-1$|IU?_abZxDm8h_#YH~p}oM3qHBd4N7n)uL05x|q5p%|grYBW
zCAc`c96S_sDLgc^4)4UnK<7%Mb@&qY#(Z0J538c+3+=*ta2AVrhlxmeyY{`UO`=`+
z0yf}2j>H3dBA&JFK&P5SMH_NH<~Q*%T9)Y={xvSBF|-S}@ivM};3x1Ra80B2;<^=k
zyaN~UB<Aoc(%cx@UGWdh;5yDlRf|Hq8e8zQ@zY|Av$fUFMW1vpdf+n0RBVic)m>b{
s)1jP?aSb=3z=jrMqxW1RxK#WZ0OW)K%o7;i2LJ#707*qoM6N<$g1p=|o&W#<

literal 0
HcmV?d00001

diff --git a/XFFruit/ViewControllers/Business/BusinessViewController.m b/XFFruit/ViewControllers/Business/BusinessViewController.m
index 50f2698..e91152f 100644
--- a/XFFruit/ViewControllers/Business/BusinessViewController.m
+++ b/XFFruit/ViewControllers/Business/BusinessViewController.m
@@ -25,6 +25,10 @@
 #import "NewPurchaseNoticeViewController.h"
 #import "SeePurchaseNoticeViewController.h"
 
+
+#import "NewPurchaseViewController.h"
+#import "PurchaseViewController.h"
+
 @interface BusinessViewController ()<ICRFunctionBaseViewDelegate>
 
 @end
@@ -151,6 +155,22 @@
         }
             break;
        
+            case kFunctionNewPurchase://新建采购单
+        {
+            NewPurchaseViewController *nvc = [[NewPurchaseViewController alloc]init];
+            nvc.title = @"新建采购单";
+            [self PushViewController:nvc animated:YES];
+
+        }
+            break;
+        case kFunctionSeePurchase:{
+            PurchaseViewController *pvc = [[PurchaseViewController alloc]init];
+            pvc.title = @"采购单";
+            [self PushViewController:pvc animated:YES];
+        }
+            break;
+            
+            
         case kFunctionTaskManagement://任务管理
         {
             ICRTaskListViewController *tVC = [[ICRTaskListViewController alloc] init];
diff --git a/XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.h b/XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.h
new file mode 100644
index 0000000..128114d
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.h
@@ -0,0 +1,15 @@
+//
+//  ChooseSupplierViewController.h
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "ICRBaseViewController.h"
+typedef void(^ChoseVendor)(NSArray *vendor);
+
+@interface ChooseVendorViewController : ICRBaseViewController
+@property (nonatomic,assign) BOOL isMoreChose;//是否是多选
+@property (nonatomic,copy)ChoseVendor choseVendor;
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.m b/XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.m
new file mode 100644
index 0000000..4567c81
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Controllers/ChooseVendorViewController.m
@@ -0,0 +1,257 @@
+//
+//  ChooseSupplierViewController.m
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "ChooseVendorViewController.h"
+#import "MaskCell.h"
+#import "Vendor.h"
+#define TopMargin 50
+#define TableHeight 50
+@interface ChooseVendorViewController ()<UITableViewDataSource,UITableViewDelegate,UITextFieldDelegate>
+{
+    UITextField *_selectTextFiled;
+    NSIndexPath *_currentIndexPath;
+    
+}
+@property (nonatomic,strong)NSMutableArray *dataArr;
+@property (nonatomic,strong)UITableView *tableView;
+@property (nonatomic,strong)NSMutableArray *indexArr;
+@end
+
+@implementation ChooseVendorViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    [self initData];
+    [self bulidLayout];
+}
+- (void)initData{
+    self.dataArr = [NSMutableArray array];
+    self.indexArr = [NSMutableArray array];
+    Vendor *v = [[Vendor alloc]init];
+    v.name = @"dddd";
+    v.code = @"1111";
+    [self.dataArr addObject:v];
+//    [self fetchVendorList];
+    
+//    __weak typeof(self)weakSelf = self;
+//    void(^succ)(id) = ^(id data) {
+//        [IBTLoadingView hideHUDWithText:nil];
+//        if (data) {
+//            __strong __typeof(weakSelf)strongSelf = weakSelf;
+//            [strongSelf fetchVendorList];
+//        }else{
+//            [IBTLoadingView showTips:data];
+//        }
+//    };
+//    
+//    void(^fail)(id) = ^(id data) {
+//        [IBTLoadingView hideHUDWithText:nil];
+//        [IBTLoadingView showTips:data];
+//        __strong __typeof(weakSelf)strongSelf = weakSelf;
+//        [strongSelf fetchVendorList];
+//    };
+//    [IBTLoadingView showProgressLabel:@"正在加载..."];
+//    [[ICRHTTPController sharedController] getVendorWithPage_number:0 page_size:100 success:succ failure:fail];
+}
+
+#pragma mark -成功
+- (void)fetchVendorList{
+    ICRDatabaseFetchBlock fetchBlk = ^FMResultSet *(FMDatabase *db) {
+        NSString * sql = [NSString stringWithFormat:@"SELECT * FROM %@ ORDER BY %@", [Vendor TableName], @"uuid"];
+        return [db executeQuery:sql];
+    };
+    
+    __weak typeof(self)weakSelf = self;
+    ICRDatabaseFetchResultsBlock fetchResultsBlk = ^(NSArray *fetchedObjects) {
+        __strong __typeof(weakSelf)strongSelf = weakSelf;
+        [strongSelf.dataArr removeAllObjects];
+        [strongSelf.dataArr addObjectsFromArray:fetchedObjects];
+        [strongSelf.tableView reloadData];
+    };
+    
+    ICRDataBaseController *dbCtrl = [ICRDataBaseController sharedController];
+    [dbCtrl runFetchForClass:[Vendor class]
+                  fetchBlock:fetchBlk
+           fetchResultsBlock:fetchResultsBlk];
+}
+
+
+#pragma mark - 插入数据
+
+
+- (void)bulidLayout
+{
+    self.view.backgroundColor = HexColor(@"f8f8f8");
+    _selectTextFiled = [[UITextField alloc] initWithFrame:CGRectMake(20,5,ScreenSize.width - 40,TopMargin -10)];
+    _selectTextFiled.textAlignment = NSTextAlignmentLeft;
+    _selectTextFiled.background = [UIImage imageNamed:@"textFiled"];
+    _selectTextFiled.delegate = self;
+    _selectTextFiled.font = FontSize(15);
+    [self.view addSubview:_selectTextFiled];
+    
+    UIImageView *leftView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 35, 40)];
+    leftView.image = [UIImage imageNamed:@"search"];
+    _selectTextFiled.leftView = leftView;
+    _selectTextFiled.leftViewMode = UITextFieldViewModeAlways;
+    
+    UIButton *rightView = [UIButton buttonWithType:UIButtonTypeCustom];
+    [rightView setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
+    rightView.frame = CGRectMake(0, 0, 35, 40);
+    [rightView addTarget:self action:@selector(deletePerson) forControlEvents:UIControlEventTouchUpInside];
+    _selectTextFiled.rightView = rightView;
+    _selectTextFiled.rightViewMode = UITextFieldViewModeAlways;
+    
+    
+    self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
+    self.tableView.backgroundColor = [UIColor whiteColor];
+    self.tableView.delegate = self;
+    self.tableView.dataSource = self;
+    [self.view addSubview:self.tableView];
+    
+    
+    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
+    self.navigationItem.rightBarButtonItem = rightItem;
+}
+
+- (void)sureClick{
+    if (self.isMoreChose) {
+        NSMutableArray *arr = [[NSMutableArray alloc]init];
+        for (NSIndexPath *index in self.indexArr) {
+            Vendor *vendor = self.dataArr[index.row];
+            [arr addObject:vendor];
+        }
+        self.choseVendor(arr);
+        
+    }else{
+        NSMutableArray *arr = [[NSMutableArray alloc]init];
+        if (self.dataArr.count > 0) {
+            Vendor *vendor = self.dataArr[_currentIndexPath.row];
+            [arr addObject:vendor];
+            self.choseVendor(arr);
+        }
+    }
+    [self PopViewControllerAnimated:YES];
+}
+
+
+- (void)deletePerson {
+    if (self.isMoreChose) {
+        [self.indexArr removeAllObjects];
+    }else{
+        _currentIndexPath = nil;
+    }
+    _selectTextFiled.text = @"";
+    [self.tableView reloadData];
+    
+}
+
+#pragma mark - 协议方法
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.dataArr.count;
+}
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    static NSString *cellID = @"MaskCell";
+    MaskCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
+    if (cell == nil) {
+        cell = [[MaskCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID totalWidth:ScreenSize.width totalHeight:TableHeight];
+        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+        cell.selectionStyle = UITableViewCellSelectionStyleNone;
+        cell.Commitbtn.hidden = YES;
+    }
+    if (self.isMoreChose) {
+        if ([self isHaveIndexPath:indexPath]) {
+            cell.Commitbtn.hidden = NO;
+        }else{
+            cell.Commitbtn.hidden = YES;
+        }
+    }else{
+        if (_currentIndexPath) {
+            if (indexPath.row == _currentIndexPath.row) {
+                cell.Commitbtn.hidden = NO;
+            }else{
+                cell.Commitbtn.hidden = YES;
+            }
+        }else{
+            cell.Commitbtn.hidden = YES;
+        }
+    }
+    if (self.dataArr.count > 0) {
+        Vendor *vendor =  self.dataArr[indexPath.row];
+         NSString *proStr = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
+        [cell setTitleStr:proStr];
+    }
+    return cell;
+}
+
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
+    if (self.isMoreChose == YES) {
+        MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
+        cell.Commitbtn.hidden = NO;
+        if (![self isHaveIndexPath:indexPath]) {
+            [self.indexArr addObject:indexPath];
+        }
+        
+        NSString *personStr = @"";
+        for (NSIndexPath *index in self.indexArr) {
+            Vendor *vendor = self.dataArr[index.row];
+            if (personStr.length == 0) {
+                personStr = [personStr stringByAppendingFormat:@"%@",vendor.name];
+            }else{
+                personStr = [personStr stringByAppendingFormat:@"、%@",vendor.name];
+            }
+        }
+        _selectTextFiled.text = personStr;
+    }else{
+        MaskCell *currentCell = (MaskCell *)[tableView cellForRowAtIndexPath:_currentIndexPath];
+        currentCell.Commitbtn.hidden = YES;
+        MaskCell *cell = (MaskCell *)[tableView cellForRowAtIndexPath:indexPath];
+        cell.Commitbtn.hidden = NO;
+        _currentIndexPath = indexPath;
+        
+        
+        Vendor *vendor = self.dataArr[indexPath.row];
+        _selectTextFiled.text = vendor.name;
+        
+        
+    }
+}
+
+- (BOOL)isHaveIndexPath:(NSIndexPath *)indexPath{
+    for (NSIndexPath *path in self.indexArr) {
+        if (path.row == indexPath.row) {
+            return YES;
+        }
+    }
+    return NO;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
+    return TableHeight;
+}
+
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end
diff --git a/XFFruit/ViewControllers/Survey/controllers/Controllers/NewPurchaseViewController.h b/XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.h
similarity index 100%
rename from XFFruit/ViewControllers/Survey/controllers/Controllers/NewPurchaseViewController.h
rename to XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.h
diff --git a/XFFruit/ViewControllers/Survey/controllers/Controllers/NewPurchaseViewController.m b/XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.m
similarity index 92%
rename from XFFruit/ViewControllers/Survey/controllers/Controllers/NewPurchaseViewController.m
rename to XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.m
index 1e14af2..52fb4a9 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Controllers/NewPurchaseViewController.m
+++ b/XFFruit/ViewControllers/Purchase/Controllers/NewPurchaseViewController.m
@@ -9,6 +9,7 @@
 #import "NewPurchaseViewController.h"
 #import "TopPurchaseView.h"
 #import "ProductViewController.h"
+
 #define TopHeight 284
 #define BottomHeight 300
 #define SpaceHeight 20
@@ -24,6 +25,7 @@ typedef enum : NSUInteger {
     UIScrollView *_scrollView;
     TopPurchaseView *_purchaseView;
     UIView *_bottomView;
+    ProductViewController *_pvc ;
 }
 @end
 
@@ -31,7 +33,6 @@ typedef enum : NSUInteger {
 
 - (void)viewDidLoad {
     [super viewDidLoad];
-    self.title = @"新建采购单";
     //布局
     [self bulidLayout];
 }
@@ -65,15 +66,18 @@ typedef enum : NSUInteger {
     _bottomView.backgroundColor = [UIColor whiteColor];
     [_scrollView addSubview:_bottomView];
     
-    ProductViewController *pvc = [[ProductViewController alloc]init];
-    pvc.viewFrame = _bottomView.bounds;
-    [_bottomView addSubview:pvc.view];
+    _pvc = [[ProductViewController alloc]init];
+    _pvc.viewFrame = _bottomView.bounds;
+    [_bottomView addSubview:_pvc.view];
     
 }
 
 - (void)btnClick:(UIButton *)btn{
     
     
+}
+- (void)pushNextViewController:(id)vc{
+    [self PushViewController:vc animated:YES];
 }
 
 #pragma mark - 协议方法
diff --git a/XFFruit/ViewControllers/Survey/controllers/Controllers/ProductViewController.h b/XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.h
similarity index 89%
rename from XFFruit/ViewControllers/Survey/controllers/Controllers/ProductViewController.h
rename to XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.h
index b8b1590..e8a2af3 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Controllers/ProductViewController.h
+++ b/XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.h
@@ -12,4 +12,5 @@
 @property (nonatomic,strong)NSMutableArray *productArr;
 @property (nonatomic,strong)UITableView *tableView;
 @property (nonatomic,assign)CGRect viewFrame;
+@property (nonatomic,assign)BOOL isHiddenEdit;
 @end
diff --git a/XFFruit/ViewControllers/Survey/controllers/Controllers/ProductViewController.m b/XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.m
similarity index 87%
rename from XFFruit/ViewControllers/Survey/controllers/Controllers/ProductViewController.m
rename to XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.m
index c6d947b..bb5c81b 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Controllers/ProductViewController.m
+++ b/XFFruit/ViewControllers/Purchase/Controllers/ProductViewController.m
@@ -27,9 +27,11 @@
     self.view.backgroundColor  = XXFBgColor;
     [super viewDidLoad];
     isFirst = YES;
-    _productArr = [NSMutableArray array];
-    [_productArr addObject:@"ffff"];
-    [_productArr addObject:@"fffff"];
+    if (!self.productArr) {
+        self.productArr = [NSMutableArray array];
+    }
+    [self.productArr addObject:@"ffff"];
+    [self.productArr addObject:@"fffff"];
     [self createView];
 }
 - (void)setViewFrame:(CGRect)viewFrame{
@@ -42,16 +44,18 @@
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
     [self.view addSubview:self.tableView];
     
-    NSArray *arr = @[@"商品",@"单价",@"包装规格"];
+    NSArray *arr = @[@"商品",@"单价",@"包装数量"];
     
     HeaderCell *headCell = [[HeaderCell alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, 38) withArr:arr];
     [self.view addSubview:headCell];
     self.tableView.tableHeaderView = headCell;
     
-    FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加商品明细"];
-    [self.view addSubview:footCell];
-    footCell.delegate = self;
-    self.tableView.tableFooterView = footCell;
+    if (!self.isHiddenEdit) {
+        FooterCell *footCell = [[FooterCell alloc]initWithFrame:CGRectMake(0, 0, _tableFrame.size.width, 50) withTitle:@"+点击添加商品明细"];
+        [self.view addSubview:footCell];
+        footCell.delegate = self;
+        self.tableView.tableFooterView = footCell;
+    }
 }
 
 - (void)addClick{
@@ -67,12 +71,14 @@
     return self.productArr.count;
 }
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
-    static NSString *cellID = @"MaterialCell";
+    static NSString *cellID = @"ProductCell";
     ProductCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
     if (cell == nil) {
         cell = [[ProductCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
         cell.selectionStyle = UITableViewCellSelectionStyleNone;
-       
+        if (self.isHiddenEdit) {
+            cell.editBtn.hidden = YES;
+        }
     }
     if (indexPath.row != _currentRow) {
         cell.smallImageView.image = [UIImage imageNamed:@"arrowright"];
diff --git a/XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.h b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.h
new file mode 100644
index 0000000..8668dee
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.h
@@ -0,0 +1,15 @@
+//
+//  PurchaseDetailViewController.h
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "ICRBaseViewController.h"
+#import "PurchaseBill.h"
+@interface PurchaseDetailViewController : ICRBaseViewController
+
+@property (nonatomic,strong)PurchaseBill *bill;
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.m b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.m
new file mode 100644
index 0000000..13ae6f2
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseDetailViewController.m
@@ -0,0 +1,186 @@
+//
+//  PurchaseDetailViewController.m
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "PurchaseDetailViewController.h"
+#import "ProductViewController.h"
+
+#define BottomHeight 50
+#define LeftMargin 20
+#define LeftWidth 100
+#define LeftHeight 30
+#define TopMargin 15
+@interface PurchaseDetailViewController ()
+{
+    UIScrollView *_scrollView;
+    UIView *_purchaseView;
+    UIView *_bottomView;
+    ProductViewController *_pvc;
+}
+@property (nonatomic,strong)UILabel *billNumberLabel;
+@property (nonatomic,strong)UILabel *noticeNumberLabel;
+@property (nonatomic,strong)UILabel *createOperNameLabel;
+@property (nonatomic,strong)UILabel *checkNameLabel;
+@property (nonatomic,strong)UILabel *stateLabel;
+@property (nonatomic,strong)UILabel *vendorNameLabel;
+@property (nonatomic,strong)UILabel *totalPriceLabel;
+@property (nonatomic,strong)UILabel *noteLabel;
+@end
+
+@implementation PurchaseDetailViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+    [self bulidLayout];
+}
+
+
+
+#pragma mark - 视图初始化
+- (void)bulidLayout{
+    _scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, ScreenSize.width, ScreenSize.height - 64 - BottomHeight)];
+    _scrollView.showsHorizontalScrollIndicator  = NO;
+    _scrollView.showsVerticalScrollIndicator = NO;
+    _scrollView.backgroundColor = HexColor(@"f8f8f8");
+    [self.view addSubview:_scrollView];
+    
+    
+    UIButton *endBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, ScreenSize.height  - 64 - BottomHeight +5, ScreenSize.width - LeftMargin*2, 40) target:self sel:@selector(btnClick:) tag:3000 image:nil title:@"结束" titleColor:[UIColor whiteColor] isCorner:YES corner:8 bgColor:HexColor(@"f69100")];
+    [self.view addSubview:endBtn];
+    
+    _purchaseView= [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, LeftHeight*8+LeftMargin)];
+    _purchaseView.backgroundColor = [UIColor whiteColor];
+    [_scrollView addSubview:_purchaseView];
+
+    
+    NSArray *leftArr = @[@"单号:",@"采购通知单:",@"创建人:",@"审核人:",@"状态:",@"供应商:",@"总金额:",@"备注:"];
+    for (NSInteger i = 0 ; i < leftArr.count; i++) {
+        UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, 10 + LeftHeight *i, LeftWidth, LeftHeight)];
+        leftLabel.font = FontSize(17);
+        leftLabel.text = leftArr[i];
+        leftLabel.textColor = HexColor(@"888888");
+        [_purchaseView addSubview:leftLabel];
+        
+        UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), 10 + LeftHeight *i, _purchaseView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
+        rightLabel.font = FontSize(17);
+        rightLabel.textColor = HexColor(@"888888");
+
+        if (i == 0) {
+            self.billNumberLabel = rightLabel;
+        }else if (i == 1) {
+            self.noticeNumberLabel = rightLabel;
+        }else if(i == 2){
+            self.createOperNameLabel = rightLabel;
+        }else if(i == 3){
+            self.checkNameLabel = rightLabel;
+        }else if(i == 4){
+            self.stateLabel = rightLabel;
+        }else if(i == 5){
+            self.vendorNameLabel = rightLabel;
+        }else if(i == 6){
+            self.totalPriceLabel = rightLabel;
+        }else if(i == 7){
+            rightLabel.numberOfLines = 0;
+            self.noteLabel = rightLabel;
+        }
+        [_purchaseView addSubview:rightLabel];
+    }
+    
+    
+    _bottomView= [[UIView alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_purchaseView.frame) + TopMargin, ScreenSize.width, 200)];
+    _bottomView.backgroundColor = [UIColor whiteColor];
+    [_scrollView addSubview:_bottomView];
+    
+    _pvc = [[ProductViewController alloc]init];
+    [self addChildViewController:_pvc];
+
+    _pvc.viewFrame = _bottomView.bounds;
+    _pvc.isHiddenEdit = YES;
+    [_bottomView addSubview:_pvc.view];
+    
+    
+    if ([self.bill.state isEqualToString:@"finished"]) {
+        endBtn.hidden = YES;
+        CGRect scrollViewFrame = _scrollView.frame;
+        scrollViewFrame.size.height = ScreenSize.height - 64;
+        _scrollView.frame = scrollViewFrame;
+    }
+    [self fetchtPurchaseDetail];
+}
+
+- (void)fetchtPurchaseDetail{
+    self.billNumberLabel.text = [IBTCommon checkString:self.bill.billNumber];
+    if ([self.bill.state isEqualToString:@"initial"]) {
+        self.stateLabel.textColor = [UIColor redColor];
+        self.stateLabel.text = @"未提交";
+    }else if ([self.bill.state isEqualToString:@"submitted"]) {
+        self.stateLabel.textColor = [UIColor greenColor];
+        self.stateLabel.text = @"已提交";
+    }else if ([self.bill.state isEqualToString:@"rejected"]) {
+        self.stateLabel.textColor = [UIColor grayColor];
+        self.stateLabel.text = @"已拒绝";
+    }else if ([self.bill.state isEqualToString:@"approved"]) {
+        self.stateLabel.textColor = [UIColor grayColor];
+        self.stateLabel.text = @"已审批";
+    }else if ([self.bill.state isEqualToString:@"shipping"]) {
+        self.stateLabel.textColor = [UIColor grayColor];
+        self.stateLabel.text = @"发运中";
+    }else if ([self.bill.state isEqualToString:@"finished"]) {
+        self.stateLabel.textColor = [UIColor blackColor];
+        self.stateLabel.text = @"已完成";
+    }
+    self.noticeNumberLabel.text = [IBTCommon checkString:self.bill.noticeNumber];
+    self.createOperNameLabel.text = [IBTCommon checkString:self.bill.create_operName];
+    self.checkNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
+    self.vendorNameLabel.text = [IBTCommon checkString:self.bill.vendor_name];
+    self.totalPriceLabel.text = [IBTCommon checkString:self.bill.total ];
+    self.noteLabel.text = [IBTCommon checkString:self.bill.remark];
+    [self setNoteHeight];
+}
+
+- (void)setNoteHeight
+{
+    CGFloat height =  [self.noteLabel calculateHeight];
+    
+    CGRect noteFrame = self.noteLabel.frame;
+    noteFrame.size.height = height;
+    self.noteLabel.frame = noteFrame;
+    
+    CGFloat totalHeight = height + LeftHeight*8;
+    CGRect purchaseFrame = _purchaseView.frame;
+    purchaseFrame.size.height = totalHeight;
+    _purchaseView.frame = purchaseFrame;
+    
+    
+    CGRect bottomFrame = _bottomView.frame;
+    bottomFrame.origin.y = CGRectGetMaxY(_purchaseView.frame) + TopMargin;
+    _bottomView.frame = bottomFrame;
+    
+    _scrollView.contentSize = CGSizeMake(ScreenSize.width, totalHeight + CGRectGetHeight(_bottomView.frame) + TopMargin*2);
+}
+
+
+
+
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.h b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.h
new file mode 100644
index 0000000..6b8fd07
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.h
@@ -0,0 +1,13 @@
+//
+//  PurchaseViewController.h
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "ICRBaseViewController.h"
+
+@interface PurchaseViewController : ICRBaseViewController
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.m b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.m
new file mode 100644
index 0000000..b4e92ca
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Controllers/PurchaseViewController.m
@@ -0,0 +1,152 @@
+//
+//  PurchaseViewController.m
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "PurchaseViewController.h"
+#import "PurchaseCell.h"
+#import "PurchaseBill.h"
+#import "PurchaseDetailViewController.h"
+
+#define TopMargin 44
+#define TableHeight 120
+#define LeftMargin 20
+#define BtnWidth 60
+#define BtnHeight 24
+#define BtnSize 16
+
+typedef enum : NSUInteger {
+    SortTag = 3000,
+    BoltTag
+    
+} BtnTag;
+@interface PurchaseViewController ()<UITableViewDataSource,UITableViewDelegate>
+{
+    UIView *_maskView;
+    UIButton *currentBtn;
+    UIBarButtonItem  *_sureBtn;
+    UIButton *_sortBtn;
+    UIButton *_boltBtn;
+}
+@property (nonatomic,strong)NSMutableArray *dataArr;
+@property (nonatomic,strong)UITableView *tableView;
+@end
+
+@implementation PurchaseViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    self.view.backgroundColor  = XXFBgColor;
+    [self initData];
+    [self createTableView];
+}
+- (void)initData{
+    self.dataArr = [NSMutableArray array];
+    for (NSInteger i = 0; i < 6; i++) {
+        PurchaseBill *bill = [PurchaseBill new];
+        bill.billNumber = @"222222222";
+        bill.noticeNumber = @"134594059654 0504门店补货0002";
+        bill.create_operName = @"张三";
+        bill.create_time = @"2013-03-04";
+        bill.vendor_name  = @"haha";
+        bill.total = @"200å…ƒ";
+        bill.remark = @"hahahah";
+        if (i == 0) {
+            bill.state = @"initial";
+        }else if(i == 1){
+            bill.state = @"submitted";
+        }else if(i == 2){
+            bill.state = @"rejected";
+        }else if(i == 3){
+            bill.state = @"approved";
+        }else if(i == 4){
+            bill.state = @"shipping";
+        }else if(i == 5){
+            bill.state = @"finished";
+        }
+        [self.dataArr addObject:bill];
+    }
+    
+}
+- (void)createTableView
+{
+    _sureBtn = [[UIBarButtonItem alloc]initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(sureClick)];
+    
+    _sortBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(LeftMargin, 10, BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:SortTag image:@"black_arrow_down_with_text" title:nil titleColor:HexColor(@"888888") isCorner:NO corner:0 bgColor:nil];
+    _sortBtn.titleLabel.font = FontSize(BtnSize);
+    [self.view addSubview:_sortBtn];
+    
+    _boltBtn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(ScreenSize.width-BtnWidth - LeftMargin,10,BtnWidth, BtnHeight) target:self sel:@selector(sortClick:) tag:BoltTag image:@"black_filter_with_text" title:nil titleColor:HexColor(@"888888") isCorner:NO corner:0 bgColor:nil];
+    _boltBtn.titleLabel.font = FontSize(BtnSize);
+    [self.view addSubview:_boltBtn];
+    
+    
+    self.tableView = [[UITableView alloc]initWithFrame:(CGRectMake(0, TopMargin,ScreenSize.width, ScreenSize.height - 64 - TopMargin)) style:(UITableViewStylePlain)];
+    self.tableView.delegate = self;
+    self.tableView.dataSource = self;
+    [self.view addSubview:self.tableView];
+    
+    _maskView = [[UIView alloc]initWithFrame:CGRectMake(0, TopMargin, ScreenSize.width, ScreenSize.height - 64- TopMargin)];
+    _maskView.backgroundColor = RGBA(0, 0, 0, 0.5);
+    _maskView.hidden = YES;
+    [self.view addSubview:_maskView];
+}
+
+#pragma mark -按钮事件
+- (void)sortClick:(UIButton *)btn{
+}
+#pragma mark - 确定
+- (void)sureClick{
+}
+#pragma mark - 协议方法
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
+    return 1;
+}
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
+    return self.dataArr.count;
+}
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
+    static NSString *cellID = @"SurveyID";
+    PurchaseCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
+    if (cell == nil) {
+        cell = [[PurchaseCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
+        tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+        cell.selectionStyle = UITableViewCellSelectionStyleNone;
+    }
+    if (self.dataArr.count > 0) {
+        PurchaseBill *bill = self.dataArr[indexPath.row];
+        [cell setPurchaseBill:bill];
+    }
+    return cell;
+}
+
+- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
+    PurchaseDetailViewController *pvc = [PurchaseDetailViewController new];
+    pvc.title = @"查看采购单";
+    pvc.bill = _dataArr[indexPath.row];
+    [self PushViewController:pvc animated:YES];
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
+    return TableHeight;
+}
+
+
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+}
+/*
+#pragma mark - Navigation
+
+// In a storyboard-based application, you will often want to do a little preparation before navigation
+- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
+    // Get the new view controller using [segue destinationViewController].
+    // Pass the selected object to the new view controller.
+}
+*/
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h b/XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
new file mode 100644
index 0000000..f5dc789
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Models/PurchaseBill.h
@@ -0,0 +1,36 @@
+//
+//  PurchaseBill.h
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "IBTModel.h"
+
+@interface PurchaseBill : IBTModel
+@property (nonatomic,strong)NSString *uuid;//唯一标识
+@property (nonatomic,strong)NSString *version;//版本
+
+@property (nonatomic,strong)NSString *noticeUuid;//采购通知单uuid
+@property (nonatomic,strong)NSString *noticeNumber;//采购通知单号
+@property (nonatomic,strong)NSString *billNumber;//采购单号
+@property (nonatomic,strong)NSString *vendor_uuid;//供应商uuid
+@property (nonatomic,strong)NSString *vendor_code;//供应商代码
+@property (nonatomic,strong)NSString *vendor_name;//供应商姓名
+@property (nonatomic,strong)NSString *total;//总金额
+@property (nonatomic,strong)NSString *endDate;//调研结束时间
+@property (nonatomic,strong)NSString *remark;//备注
+@property (nonatomic,strong)NSString *state;// initial(未提交)submitted(已提交)rejected(已拒绝)approved(已审批)shipping(发运中)finished(已完成)
+@property (nonatomic,strong)NSString *vendorConfirmTime;//供应商确认时间
+@property (nonatomic,strong)NSString *create_time;//创建时间
+@property (nonatomic,strong)NSString *create_id;//创建人代码
+@property (nonatomic,strong)NSString *create_operName;//创建人名称
+@property (nonatomic,strong)NSString *lastModified_time;//最后修改时间
+@property (nonatomic,strong)NSString *lastModified_id;//最后修改人代码
+@property (nonatomic,strong)NSString *astModified_operName;//最后修改人名称
+
+
+
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Models/PurchaseBill.m b/XFFruit/ViewControllers/Purchase/Models/PurchaseBill.m
new file mode 100644
index 0000000..03fe173
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Models/PurchaseBill.m
@@ -0,0 +1,13 @@
+//
+//  PurchaseBill.m
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "PurchaseBill.h"
+
+@implementation PurchaseBill
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Models/Vendor.h b/XFFruit/ViewControllers/Purchase/Models/Vendor.h
new file mode 100644
index 0000000..db99262
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Models/Vendor.h
@@ -0,0 +1,18 @@
+//
+//  Vendor.h
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "IBTModel.h"
+
+@interface Vendor : IBTModel
+@property (nonatomic,strong)NSString *uuid;//id
+@property (nonatomic,strong)NSString *code;//代码
+@property (nonatomic,strong)NSString *name;//名称
+@property (nonatomic,assign)BOOL enabled;//状态
+
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Models/Vendor.m b/XFFruit/ViewControllers/Purchase/Models/Vendor.m
new file mode 100644
index 0000000..946f486
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Models/Vendor.m
@@ -0,0 +1,19 @@
+//
+//  Vendor.m
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//供应商
+
+#import "Vendor.h"
+
+@implementation Vendor
++ (NSDictionary *)specialKeysAndReplaceKeys {
+    return @{ @"vID" : [[self class] PrimaryKey], };
+}
+
++ (NSString *)PrimaryKey {
+    return @"uuid";
+}
+@end
diff --git a/XFFruit/ViewControllers/Survey/controllers/Views/ProductCell.h b/XFFruit/ViewControllers/Purchase/Views/ProductCell.h
similarity index 94%
rename from XFFruit/ViewControllers/Survey/controllers/Views/ProductCell.h
rename to XFFruit/ViewControllers/Purchase/Views/ProductCell.h
index 535d66e..f848acf 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Views/ProductCell.h
+++ b/XFFruit/ViewControllers/Purchase/Views/ProductCell.h
@@ -14,7 +14,7 @@
 @property (nonatomic,strong)UILabel *seqLabel;
 @property (nonatomic,strong)UILabel *titleLabel;
 @property (nonatomic,strong)UILabel *priceLabel;
-@property (nonatomic,strong)UILabel *standardLabel;
+//@property (nonatomic,strong)UILabel *standardLabel;
 @property (nonatomic,strong)UILabel *countLabel;
 
 @property (nonatomic,strong)UILabel *lineLabel;
diff --git a/XFFruit/ViewControllers/Survey/controllers/Views/ProductCell.m b/XFFruit/ViewControllers/Purchase/Views/ProductCell.m
similarity index 86%
rename from XFFruit/ViewControllers/Survey/controllers/Views/ProductCell.m
rename to XFFruit/ViewControllers/Purchase/Views/ProductCell.m
index 2864c0e..7a2cce7 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Views/ProductCell.m
+++ b/XFFruit/ViewControllers/Purchase/Views/ProductCell.m
@@ -59,18 +59,19 @@
     self.priceLabel.text = @"80";
     self.priceLabel.font = FontSize(ContentSize);
     
-    self.standardLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
-    self.standardLabel.textAlignment = NSTextAlignmentLeft;
-    self.standardLabel.text = @"20*20";
-    self.standardLabel.textColor = HexColor(ContentColor);
-    self.standardLabel.font = FontSize(ContentSize);
-    
-//    self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.standardLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
-//    self.countLabel.textAlignment = NSTextAlignmentLeft;
-//    self.countLabel.text = @"200";
-//    self.countLabel.textColor = HexColor(ContentColor);
-//    self.countLabel.font = FontSize(ContentSize);
-//    
+//    self.standardLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
+//    self.standardLabel.textAlignment = NSTextAlignmentLeft;
+//    self.standardLabel.text = @"20*20";
+//    self.standardLabel.backgroundColor = [UIColor redColor];
+//    self.standardLabel.textColor = HexColor(ContentColor);
+//    self.standardLabel.font = FontSize(ContentSize);
+    
+    self.countLabel = [[UILabel alloc]initWithFrame:(CGRectMake(CGRectGetMaxX(self.priceLabel.frame) + SpaceMargin, 0, headWidth, TableHeight))];
+    self.countLabel.textAlignment = NSTextAlignmentLeft;
+    self.countLabel.text = @"200";
+    self.countLabel.textColor = HexColor(ContentColor);
+    self.countLabel.font = FontSize(ContentSize);
+
     
     self.showView = [[UIView alloc]initWithFrame:CGRectMake(0, TableHeight, ScreenSize.width, 0)];
     self.showView.hidden = YES;
@@ -127,8 +128,8 @@
     
     
     self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
-    [self.editBtn setImage:[UIImage imageNamed:@"delete"] forState:UIControlStateNormal];
-    self.editBtn.frame = CGRectMake(ScreenSize.width - LeftWidth, 0, LeftWidth, TableHeight);
+    [self.editBtn setImage:[UIImage imageNamed:@"edit"] forState:UIControlStateNormal];
+    self.editBtn.frame = CGRectMake(ScreenSize.width - RightWidth, 0, RightWidth - LeftMargin, TableHeight);
     self.editBtn.contentMode = UIViewContentModeScaleAspectFit;
 
     self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width  - LeftMargin * 2, 1))];;
@@ -138,8 +139,9 @@
     [self.contentView addSubview:self.seqLabel];
     [self.contentView addSubview:self.titleLabel];
     [self.contentView addSubview:self.priceLabel];
-    [self.contentView addSubview:self.standardLabel];
-//    [self.contentView addSubview:self.countLabel];
+//    [self.contentView addSubview:self.standardLabel];
+    [self.contentView addSubview:self.countLabel];
+    
 
     [self.contentView addSubview:self.editBtn];
     [self.contentView addSubview:self.showView];
diff --git a/XFFruit/ViewControllers/Purchase/Views/PurchaseCell.h b/XFFruit/ViewControllers/Purchase/Views/PurchaseCell.h
new file mode 100644
index 0000000..979df8f
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Views/PurchaseCell.h
@@ -0,0 +1,22 @@
+//
+//  PurchaseCell.h
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "PurchaseBill.h"
+@interface PurchaseCell : UITableViewCell
+@property (nonatomic,strong)UILabel *billNumberLabel;//采购单号
+@property (nonatomic,strong)UILabel *noticeNumberLabel;//采购通知单号
+@property (nonatomic,strong)UILabel *createOperNameLabel;//创建人
+@property (nonatomic,strong)UILabel *createTimeLabel;//创建时间
+@property (nonatomic,strong)UILabel *lineLabel;
+@property (nonatomic,strong)UIButton *stateBtn;
+
+@property (nonatomic,strong)PurchaseBill *purchaseBill;
+
+
+@end
diff --git a/XFFruit/ViewControllers/Purchase/Views/PurchaseCell.m b/XFFruit/ViewControllers/Purchase/Views/PurchaseCell.m
new file mode 100644
index 0000000..f1abd11
--- /dev/null
+++ b/XFFruit/ViewControllers/Purchase/Views/PurchaseCell.m
@@ -0,0 +1,115 @@
+//
+//  PurchaseCell.m
+//  XFFruit
+//
+//  Created by 陈俊俊 on 15/8/23.
+//  Copyright (c) 2015å¹´ Xummer. All rights reserved.
+//
+
+#import "PurchaseCell.h"
+#define TitleSize 16
+#define ContentSize 14
+#define TitleColor @"444444"
+#define ContentColor @"aaaaaa"
+#define LeftMargin 90
+#define TopMargin 10
+#define TitleHeight 20
+#define TableHeight 120
+
+@implementation PurchaseCell
+
+- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
+    
+    self =  [super initWithStyle:style reuseIdentifier:reuseIdentifier];
+    if (self) {
+        [self bulidLayout];
+    }
+    return self;
+}
+
+- (void)bulidLayout
+{
+    self.stateBtn = [UIButton buttonWithType:UIButtonTypeCustom];
+    self.stateBtn.frame = CGRectMake(TopMargin *2 , TopMargin, LeftMargin - TopMargin*3, 20);
+    self.stateBtn.titleLabel.font = FontSize(ContentSize);
+    [self.stateBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
+    self.stateBtn.enabled = NO;
+    
+    self.billNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, TopMargin, ScreenSize.width - LeftMargin, TitleHeight))];
+    self.billNumberLabel.textColor = HexColor(TitleColor);
+    self.billNumberLabel.font = FontSize(TitleSize);
+    
+    self.noticeNumberLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.billNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight*2))];
+    self.noticeNumberLabel.numberOfLines = 0;
+    self.noticeNumberLabel.textColor = HexColor(ContentColor);
+    self.noticeNumberLabel.font = FontSize(ContentSize);
+    
+    self.createOperNameLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.noticeNumberLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
+    self.createOperNameLabel.textColor = HexColor(ContentColor);
+    self.createOperNameLabel.font = FontSize(ContentSize);
+    
+    
+    self.createTimeLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin, CGRectGetMaxY(self.createOperNameLabel.frame), ScreenSize.width - LeftMargin, TitleHeight))];
+    self.createTimeLabel.textColor = HexColor(ContentColor);
+    self.createTimeLabel.font = FontSize(ContentSize);
+    
+    self.lineLabel = [[UILabel alloc]initWithFrame:(CGRectMake(LeftMargin,TableHeight-1, ScreenSize.width - LeftMargin - TopMargin * 2, 1))];;
+    self.lineLabel.backgroundColor = HexColor(@"e5e5e5");
+    
+    [self.contentView addSubview:self.stateBtn];
+    [self.contentView addSubview:self.billNumberLabel];
+    [self.contentView addSubview:self.noticeNumberLabel];
+    [self.contentView addSubview:self.createOperNameLabel];
+    [self.contentView addSubview:self.createTimeLabel];
+    [self.contentView addSubview:self.lineLabel];
+    
+}
+
+- (void)setPurchaseBill:(PurchaseBill *)purchaseBill{
+    self.billNumberLabel.text = [NSString stringWithFormat:@"单号:%@",purchaseBill.billNumber];
+    self.noticeNumberLabel.text = [NSString stringWithFormat:@"采购通知单:%@",purchaseBill.noticeNumber];
+    self.createOperNameLabel.text = [NSString stringWithFormat:@"创建人:%@",purchaseBill.create_operName] ;
+    self.createTimeLabel.text =[NSString stringWithFormat:@"创建时间:%@",purchaseBill.create_time];
+    NSString *stateStr = @"";
+    if ([purchaseBill.state isEqualToString:@"initial"]) {
+        stateStr = @"未提交";
+        [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"initial"]  forState:UIControlStateDisabled];
+    }else if ([purchaseBill.state isEqualToString:@"submitted"]) {
+        stateStr = @"已提交";
+        [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
+    }else if ([purchaseBill.state isEqualToString:@"rejected"]) {
+        stateStr = @"已拒绝";
+        [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
+        
+    }else if ([purchaseBill.state isEqualToString:@"approved"]) {
+        stateStr = @"已审批";
+        [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
+        
+    }else if ([purchaseBill.state isEqualToString:@"shipping"]) {
+        stateStr = @"发运中";
+        [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"insurvey"] forState:UIControlStateDisabled];
+        
+    }else if ([purchaseBill.state isEqualToString:@"finished"]) {
+        stateStr = @"已完成";
+        [self.stateBtn setBackgroundImage:[UIImage imageNamed:@"finish"] forState:UIControlStateDisabled];
+    }
+    [self.stateBtn setTitle:stateStr forState:UIControlStateNormal];
+}
+
+
+
+
+
+
+
+- (void)awakeFromNib {
+    // Initialization code
+}
+
+- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
+    [super setSelected:selected animated:animated];
+
+    // Configure the view for the selected state
+}
+
+@end
diff --git a/XFFruit/ViewControllers/Survey/controllers/Views/TopPurchaseView.h b/XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
similarity index 95%
rename from XFFruit/ViewControllers/Survey/controllers/Views/TopPurchaseView.h
rename to XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
index a3ef80e..ff65eaf 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Views/TopPurchaseView.h
+++ b/XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.h
@@ -12,7 +12,7 @@
 @protocol TopPurchaseViewDelegate <NSObject>
 
 - (void)hiddenKeyBoard;
-
+- (void)pushNextViewController:(id)vc;
 @end
 
 @interface TopPurchaseView : UIView
diff --git a/XFFruit/ViewControllers/Survey/controllers/Views/TopPurchaseView.m b/XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
similarity index 87%
rename from XFFruit/ViewControllers/Survey/controllers/Views/TopPurchaseView.m
rename to XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
index 8088601..3613b66 100644
--- a/XFFruit/ViewControllers/Survey/controllers/Views/TopPurchaseView.m
+++ b/XFFruit/ViewControllers/Purchase/Views/TopPurchaseView.m
@@ -9,12 +9,14 @@
 #import "TopPurchaseView.h"
 
 #import "SurveyCell.h"
+#import "ChooseVendorViewController.h"
+#import "Vendor.h"
 #define LeftMargin 15
 #define TopMargin 20
 #define LeftWidth 80
 #define TableHeight 44
 #define SpaceHeight 10
-#define TitleSize 16
+#define TitleSize 15
 
 @interface TopPurchaseView ()<UITableViewDataSource,UITableViewDelegate,HPGrowingTextViewDelegate,UITextFieldDelegate>
 {
@@ -119,7 +121,21 @@
         }
     }
 }
-
+-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
+    if(indexPath.row == 2){
+        ChooseVendorViewController *cvc = [ChooseVendorViewController new];
+        cvc.choseVendor = ^(NSArray *vendors){
+            if (vendors.count > 0) {
+                Vendor *vendor = vendors[0];
+              self.purchaseSupplierLabel.text = [NSString stringWithFormat:@"%@[%@]",vendor.name,vendor.code];
+                 self.purchaseSupplierLabel.textColor = HexColor(@"444444");
+            }
+            
+        };
+        cvc.isMoreChose = NO;
+        [self.delegate pushNextViewController:cvc];
+    }
+}
 - (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)growingTextView{
     [self.remarkTextView resignFirstResponder];
     return YES;
diff --git a/XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m b/XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
index 3200b22..942144d 100644
--- a/XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
+++ b/XFFruit/ViewControllers/Survey/controllers/NewSurveyViewController.m
@@ -354,7 +354,7 @@ typedef enum : NSUInteger {
         ChosePersonViewController *cvc = [ChosePersonViewController new];
         cvc.chosePerson = ^(NSArray *users){
             NSString *textStr = @"";
-            if (self.users.count <=0) {
+            if (self.users.count >0) {
                 [self.users removeAllObjects];
             }
             for (SurveyUser *user in users) {
diff --git a/XFFruit/ViewControllers/Survey/controllers/SurveyDetailViewController.m b/XFFruit/ViewControllers/Survey/controllers/SurveyDetailViewController.m
index 06386f9..2f320a2 100644
--- a/XFFruit/ViewControllers/Survey/controllers/SurveyDetailViewController.m
+++ b/XFFruit/ViewControllers/Survey/controllers/SurveyDetailViewController.m
@@ -45,6 +45,10 @@ typedef enum : NSUInteger {
     [super viewDidLoad];
      self.title = @"行情调研详情";
     [self bulifLayout];
+    [self getDataFromServer];
+}
+
+- (void)getDataFromServer{
     __weak typeof(self)weakSelf = self;
     void(^succ)(id) = ^(id data) {
         [IBTLoadingView hideHUDWithText:nil];
@@ -62,7 +66,7 @@ typedef enum : NSUInteger {
                 [IBTLoadingView showTips:message];
             }
         }else{
-          [strongSelf fetchtSurveyDetail];
+            [strongSelf fetchtSurveyDetail];
         }
         [self createResultChart];
     };
@@ -152,7 +156,7 @@ typedef enum : NSUInteger {
     UILabel *tagLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
     tagLabel.text = @"【调研内容】";
     tagLabel.font =  FontSize(17);
-    tagLabel.textColor = [UIColor blueColor];
+    tagLabel.textColor = HexColor(@"7ebf74");
     [_surveyView addSubview:tagLabel];
     
     NSArray *leftArr = @[@"单号:",@"状态:",@"标题:",@"商品:",@"开始日期:",@"截止日期:",@"调研人员:",@"备注:"];
@@ -160,11 +164,12 @@ typedef enum : NSUInteger {
         UILabel *leftLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin, CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, LeftWidth, LeftHeight)];
         leftLabel.font = FontSize(17);
         leftLabel.text = leftArr[i];
+        leftLabel.textColor = HexColor(@"888888");
         [_surveyView addSubview:leftLabel];
         
         UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetMaxX(leftLabel.frame), CGRectGetMaxY(tagLabel.frame) + LeftHeight *i, _surveyView.frame.size.width - LeftMargin - LeftWidth, LeftHeight)];
         rightLabel.font = FontSize(17);
-
+        rightLabel.textColor = HexColor(@"888888");
         if (i == 0) {
             self.billNumberLabel = rightLabel;
         }else if (i == 1) {
@@ -195,13 +200,13 @@ typedef enum : NSUInteger {
     UILabel *resultLabel = [[UILabel alloc]initWithFrame:CGRectMake(LeftMargin/2, 10, LeftWidth*2, LeftHeight)];
     resultLabel.text = @"【行情反馈】";
     resultLabel.font =  FontSize(17);
-    resultLabel.textColor = [UIColor blueColor];
+    resultLabel.textColor = HexColor(@"7ebf74");
     [_bottomView addSubview:resultLabel];
     
     _chartImageView = [[UIImageView alloc]initWithFrame:CGRectMake(10, CGRectGetMaxY(resultLabel.frame) + 10, CGRectGetWidth(_bottomView.frame) - 20, CGRectGetHeight(_bottomView.frame) - LeftHeight - 20)];
     [_bottomView addSubview:_chartImageView];
     
-    UIButton *btn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bottomView.frame) - 100, 10, 100, LeftHeight) target:self sel:@selector(btnClick:) tag:DetailTag image:nil title:@">>查看详情" titleColor:[UIColor blueColor] isCorner:NO corner:0 bgColor:nil];
+    UIButton *btn = [IBTCustomButtom creatButtonWithFrame:CGRectMake(CGRectGetWidth(_bottomView.frame) - 100, 10, 100, LeftHeight) target:self sel:@selector(btnClick:) tag:DetailTag image:nil title:@">>查看详情" titleColor:HexColor(@"7ebf74") isCorner:NO corner:0 bgColor:nil];
     [_bottomView addSubview:btn];
     
     
diff --git a/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m b/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
index b79e12b..0a91b94 100644
--- a/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
+++ b/XFFruit/ViewControllers/Survey/controllers/SurveyViewController.m
@@ -85,7 +85,6 @@ typedef enum : NSUInteger {
     [IBTLoadingView showProgressLabel:@"正在加载..."];
     ICRUserUtil *userUtil = [ICRUserUtil sharedInstance];
     
-    id orderFieldObject =  [NSNull null];
     NSMutableArray *orderArr =[NSMutableArray array];
     if (self.orderDirection.length > 0) {
         QueryOrder *order = [QueryOrder new];
-- 
2.18.1