张洋 1 month ago
parent
commit
9bf5dc6b61

+ 21 - 21
bin/Win32/Debug/zhipuzi_pos_windows/skin/shangpin_create_wnd.xml

@@ -35,11 +35,31 @@
 			</HorizontalLayout>
 
 			<HorizontalLayout height="44" padding="0,25,0,0">
-				<Label text="商品价格:" width="110" height="44" padding="20,0,0,0"></Label>
+				<Label text="销售价格:" width="110" height="44" padding="20,0,0,0"></Label>
 				<Edit name="shangpin_create_dlg_price_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
 				<Label text="元" width="80" height="44" padding="20,0,0,0"></Label>
 			</HorizontalLayout>
 
+			<HorizontalLayout height="44" padding="0,25,0,0">
+				<Label text="进货价:" width="110" height="44" padding="20,0,0,0"></Label>
+				<Edit name="shangpin_create_dlg_buyingprice_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
+				<Label text="元" width="80" height="44" padding="20,0,0,0"></Label>
+			</HorizontalLayout>
+
+			<HorizontalLayout height="88" padding="0,25,0,0">
+				<Label text="进货价模式:" width="110" height="44" padding="20,0,0,0"></Label>
+				<VerticalLayout>
+					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
+						<CheckBox name="shangpin_create_dlg_jinhuojia_normal" group="shangpin_create_dlg_jinhuojia_type" selected="true" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+						<Label text="按当前商品进货价 (一般用于临时加工销售的商品)" width="520" padding="10,0,0,0"/>
+					</HorizontalLayout>
+					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
+						<CheckBox name="shangpin_create_dlg_jinhuojia_jiaquan" group="shangpin_create_dlg_jinhuojia_type" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+						<Label text="按加权平均库存成本价 (一般用于采购入库销售的商品)" width="520" padding="10,0,0,0"/>
+					</HorizontalLayout>
+				</VerticalLayout>
+			</HorizontalLayout>
+
 			<HorizontalLayout height="44" padding="0,25,0,0">
 				<Label text="商品单位:" width="110" height="44" padding="20,0,0,0"></Label>
 				<Edit name="shangpin_create_dlg_unit_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
@@ -86,26 +106,6 @@
 				</HorizontalLayout>
 			</HorizontalLayout>
 
-			<HorizontalLayout height="44" padding="0,25,0,0">
-				<Label text="进货价:" width="110" height="44" padding="20,0,0,0"></Label>
-				<Edit name="shangpin_create_dlg_buyingprice_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
-				<Label text="元" width="80" height="44" padding="20,0,0,0"></Label>
-			</HorizontalLayout>
-
-			<HorizontalLayout height="88" padding="0,25,0,0">
-				<Label text="进货价模式:" width="110" height="44" padding="20,0,0,0"></Label>
-				<VerticalLayout>
-					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
-						<CheckBox name="shangpin_create_dlg_jinhuojia_normal" group="shangpin_create_dlg_jinhuojia_type" selected="true" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
-						<Label text="按当前商品进货价 (一般用于临时加工销售的商品)" width="520" padding="10,0,0,0"/>
-					</HorizontalLayout>
-					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
-						<CheckBox name="shangpin_create_dlg_jinhuojia_jiaquan" group="shangpin_create_dlg_jinhuojia_type" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
-						<Label text="按加权平均库存成本价 (一般用于采购入库销售的商品)" width="520" padding="10,0,0,0"/>
-					</HorizontalLayout>
-				</VerticalLayout>
-			</HorizontalLayout>
-
 			<HorizontalLayout height="44" padding="0,25,0,0">
 				<Label text="在哪些地方显示:" wordbreak="true" width="110" height="44" padding="20,0,0,0"></Label>
 

+ 21 - 21
bin/Win32/Debug/zhipuzi_pos_windows/skin/shangpin_update_wnd.xml

@@ -35,11 +35,31 @@
 			</HorizontalLayout>
 
 			<HorizontalLayout height="44" padding="0,25,0,0">
-				<Label text="商品价格:" width="110" height="44" padding="20,0,0,0"></Label>
+				<Label text="销售价格:" width="110" height="44" padding="20,0,0,0"></Label>
 				<Edit name="shangpin_update_dlg_price_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
 				<Label text="元" width="80" height="44" padding="20,0,0,0"></Label>
 			</HorizontalLayout>
 
+			<HorizontalLayout height="44" padding="0,25,0,0">
+				<Label text="进货价:" width="110" height="44" padding="20,0,0,0"></Label>
+				<Edit name="shangpin_update_dlg_buyingprice_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
+				<Label text="元" width="80" height="44" padding="20,0,0,0"></Label>
+			</HorizontalLayout>
+
+			<HorizontalLayout height="88" padding="0,25,0,0">
+				<Label text="进货价模式:" width="110" height="44" padding="20,0,0,0"></Label>
+				<VerticalLayout>
+					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
+						<CheckBox name="shangpin_update_dlg_jinhuojia_normal" group="shangpin_update_dlg_jinhuojia_type" selected="true" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+						<Label text="按当前商品进货价 (一般用于临时加工销售的商品)" width="520" padding="10,0,0,0"/>
+					</HorizontalLayout>
+					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
+						<CheckBox name="shangpin_update_dlg_jinhuojia_jiaquan" group="shangpin_update_dlg_jinhuojia_type" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
+						<Label text="按加权平均库存成本价 (一般用于采购入库销售的商品)" width="520" padding="10,0,0,0"/>
+					</HorizontalLayout>
+				</VerticalLayout>
+			</HorizontalLayout>
+
 			<HorizontalLayout height="44" padding="0,25,0,0">
 				<Label text="商品单位:" width="110" height="44" padding="20,0,0,0"></Label>
 				<Edit name="shangpin_update_dlg_unit_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
@@ -86,26 +106,6 @@
 				</HorizontalLayout>
 			</HorizontalLayout>
 
-			<HorizontalLayout height="44" padding="0,25,0,0">
-				<Label text="进货价:" width="110" height="44" padding="20,0,0,0"></Label>
-				<Edit name="shangpin_update_dlg_buyingprice_edit" width="200" height="44" padding="15,0,0,0" borderround="10,10" bkcolor="#FFF2F2F2" nativebkcolor="#FFF2F2F2" />
-				<Label text="元" width="80" height="44" padding="20,0,0,0"></Label>
-			</HorizontalLayout>
-
-			<HorizontalLayout height="88" padding="0,25,0,0">
-				<Label text="进货价模式:" width="110" height="44" padding="20,0,0,0"></Label>
-				<VerticalLayout>
-					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
-						<CheckBox name="shangpin_update_dlg_jinhuojia_normal" group="shangpin_update_dlg_jinhuojia_type" selected="true" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
-						<Label text="按当前商品进货价 (一般用于临时加工销售的商品)" width="520" padding="10,0,0,0"/>
-					</HorizontalLayout>
-					<HorizontalLayout padding="30,0,30,0" width="560" height="44">
-						<CheckBox name="shangpin_update_dlg_jinhuojia_jiaquan" group="shangpin_update_dlg_jinhuojia_type" padding="0,15,0,15" width="13" height="13" normalimage="file='RadioBtnNon.png'" hotimage="file='RadioBtnNon.png'" selectedimage="file='RadioBtnSel.png'"/>
-						<Label text="按加权平均库存成本价 (一般用于采购入库销售的商品)" width="520" padding="10,0,0,0"/>
-					</HorizontalLayout>
-				</VerticalLayout>
-			</HorizontalLayout>
-
 			<HorizontalLayout height="44" padding="0,25,0,0">
 				<Label text="在哪些地方显示:" wordbreak="true" width="110" height="44" padding="20,0,0,0"></Label>
 

+ 1 - 1
zhipuzi_pos_windows/page/CShangpinPageUI.cpp

@@ -265,7 +265,7 @@ void CShangpinPageUI::InitFoodShow()
 	{
 		//选择的是普通商品分类
 		CSqlite3 sqlite;
-		std::vector<CFood> foodlist = sqlite.GetFoodByTypeid(m_cur_type_id);
+		std::vector<CFood> foodlist = sqlite.GetFoodByTypeid(m_cur_type_id, true);
 
 		for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
 		{

+ 68 - 15
zhipuzi_pos_windows/tool/CSqlite3.cpp

@@ -1254,31 +1254,84 @@ bool CSqlite3::GetFoodtypeById(std::string foodtype_id, CFoodType& newFoodType)
 	return is_found;
 }
 
-/**
- * 如果type_id为0,表示读取所有商品,否则只读取当前type_id的商品
- */
-std::vector<CFood> CSqlite3::GetFoodByTypeid(std::string type_id, bool is_shouyinji_show)
+std::vector<CFood> CSqlite3::GetAllFood()
 {
-	type_id = CLewaimaiString::SqlZhuanyi(type_id);
-
 	std::vector<CFood> data;
 
-	std::string sql;
+	std::string sql = "SELECT * FROM pos_food WHERE is_shouyinji_show = '1' ORDER BY tag ASC";
 
-	if (is_shouyinji_show)
+	sqlite3_stmt* stmt = NULL;
+
+	if (sqlite3_prepare_v2(m_db, sql.c_str(), -1, &stmt, NULL) == SQLITE_OK)
 	{
-		sql = "SELECT * FROM pos_food WHERE status='NORMAL' and is_shouyinji_show = '1'";
+		while (sqlite3_step(stmt) == SQLITE_ROW)
+		{
+			CFood newFood;
+
+			newFood.id = (char*)sqlite3_column_text(stmt, 0);
+			newFood.shop_id = (char*)sqlite3_column_text(stmt, 1);
+			newFood.name = (char*)sqlite3_column_text(stmt, 2);
+			newFood.price = (char*)sqlite3_column_text(stmt, 3);
+			newFood.tag = (char*)sqlite3_column_text(stmt, 4);
+			newFood.status = (char*)sqlite3_column_text(stmt, 5);
+			newFood.type_id = (char*)sqlite3_column_text(stmt, 6);
+			newFood.is_dabao = (char*)sqlite3_column_text(stmt, 7);
+			newFood.dabao_money = (char*)sqlite3_column_text(stmt, 8);
+			newFood.is_nature = (char*)sqlite3_column_text(stmt, 9);
+			newFood.nature = (char*)sqlite3_column_text(stmt, 10);
+			newFood.autostocknum = (char*)sqlite3_column_text(stmt, 11);
+			newFood.goods_img = (char*)sqlite3_column_text(stmt, 12);
+			newFood.unit = (char*)sqlite3_column_text(stmt, 13);
+			newFood.barcode = (char*)sqlite3_column_text(stmt, 14);
+			newFood.member_price_used = (char*)sqlite3_column_text(stmt, 15);
+			newFood.member_price = (char*)sqlite3_column_text(stmt, 16);
+			newFood.buying_price = (char*)sqlite3_column_text(stmt, 17);
+			newFood.stock = (char*)sqlite3_column_text(stmt, 18);
+			newFood.stockvalid = (char*)sqlite3_column_text(stmt, 19);
+			newFood.stock_warning = (char*)sqlite3_column_text(stmt, 20);
+			newFood.is_shouyinji_show = (char*)sqlite3_column_text(stmt, 21);
+			newFood.is_waimai_show = (char*)sqlite3_column_text(stmt, 22);
+			newFood.is_tangshi_show = (char*)sqlite3_column_text(stmt, 23);
+			newFood.is_zhengcan_show = (char*)sqlite3_column_text(stmt, 24);
+			newFood.expiration_date = (char*)sqlite3_column_text(stmt, 25);
+			newFood.is_weight = (char*)sqlite3_column_text(stmt, 26);
+			newFood.weight_plu_code = (char*)sqlite3_column_text(stmt, 27);
+			newFood.weight_food_code = (char*)sqlite3_column_text(stmt, 28);
+			newFood.jiagong_type = (char*)sqlite3_column_text(stmt, 29);
+			newFood.cost_mode = (char*)sqlite3_column_text(stmt, 30);
+			newFood.member_price_json = (char*)sqlite3_column_text(stmt, 31);
+
+			data.push_back(newFood);
+		}
+
+		sqlite3_finalize(stmt);
 	}
 	else
 	{
-		sql = "SELECT * FROM pos_food WHERE status='NORMAL'";
+		//异常情况
+		sqlite3_finalize(stmt);
 	}
 
-	if (type_id != "0")
+	return data;
+}
+
+std::vector<CFood> CSqlite3::GetFoodByTypeid(std::string type_id, bool is_show_closed)
+{
+	type_id = CLewaimaiString::SqlZhuanyi(type_id);
+
+	std::vector<CFood> data;
+
+	std::string sql;
+
+	if (is_show_closed == true)
 	{
-		sql += " AND type_id = '" + type_id + "'";
+		sql = "SELECT * FROM pos_food WHERE type_id = '" + type_id + "'";
 	}
-
+	else
+	{
+		sql = "SELECT * FROM pos_food WHERE status='NORMAL' AND is_shouyinji_show = '1' AND type_id = '" + type_id + "'";
+	}
+	
 	sql += " ORDER BY tag ASC";
 
 	sqlite3_stmt * stmt = NULL;
@@ -1342,7 +1395,7 @@ std::vector<CFood> CSqlite3::GetFoodForTiaomacheng()
 
 	std::string sql;
 
-	sql = "SELECT * FROM pos_food WHERE is_weight = '1' AND weight_plu_code != '' AND weight_food_code != ''";
+	sql = "SELECT * FROM pos_food WHERE is_weight = '1' AND weight_plu_code != ''";
 
 	sqlite3_stmt * stmt = NULL;
 
@@ -1760,4 +1813,4 @@ void CSqlite3::UpdateFoodStock(std::string food_id, std::string stock)
 	result = sqlite3_exec(m_db, sql.c_str(), 0, 0, 0);
 
 	result = sqlite3_exec(m_db, "COMMIT;", 0, 0, 0);
-}
+}

+ 4 - 1
zhipuzi_pos_windows/tool/CSqlite3.h

@@ -45,8 +45,11 @@ public:
 
 	bool GetFoodtypeById(std::string foodtype_id, CFoodType& newFoodType);
 
+	//获取所有商品信息
+	std::vector<CFood> GetAllFood();
+
 	//获取某一个商品分类下的商品
-	std::vector<CFood> GetFoodByTypeid(std::string type_id, bool is_shouyinji_show = true);
+	std::vector<CFood> GetFoodByTypeid(std::string type_id, bool is_show_closed = false);
 
 	//获取某一个商品分类下的商品
 	std::vector<CFood> GetFoodForTiaomacheng();

+ 1 - 1
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -93,7 +93,7 @@ void CMainWnd::UpdateFoodImage()
 	}
 
 	CSqlite3 sqlite;
-	std::vector<CFood> foodlist = sqlite.GetFoodByTypeid("0", true);
+	std::vector<CFood> foodlist = sqlite.GetAllFood();
 	for (std::vector<CFood>::iterator it = foodlist.begin(); it != foodlist.end(); it++)
 	{
 		CFood food = *it;