public function list_import_product_to_json_data($data) { //new a new receipt //basically, a Reiceipt is a list of product... $receipt = new Receipt(); foreach ($data as $value) { //new Product $product = new ImportProduct($value['Import_Price']); // add attribute to it $product->add_attribute($value['Name'], new Unit($value['UnitName'], $value['Price']), $value['Id'], $value['ProductId']); //add the product to the receipt $receipt->add($product); } // return the receipt in json format return $receipt->json_encode(); }
public static function create_product($product) { if (strcmp($product['object_type'], self::PRODUCT) == 0) { $p = new Product(); } else { if (strcmp($product['object_type'], self::SOLD_PRODUCT) == 0) { $p = new SoldProduct($product['number']); } else { if (strcmp($product['object_type'], self::IMPORT_PRODUCT) == 0) { $p = new ImportProduct($product['import_price']); } } } //get data $p->get_data_from_array($product); return $p; }
function push_new_product_data_to_server($array) { if (sizeof($array) == 0) { return; } $receipt = new Receipt(); foreach ($array as $key => $product) { if (isset($product['name'])) { $import_product = new ImportProduct($product['bought']); $import_product->add_attribute($product['name'], new Unit($product['unit_name'], $product['sale'])); $receipt->add($import_product); } } echo $receipt->json_encode(true); $manage = new Management(); $manage->push_new_product_data_to_server($receipt); }
@session_unregister('skipped_rows_in_excel'); $_SESSION['totalrows'] = ''; $_SESSION['recordcount'] = 200; $_SESSION['startval'] = 0; $width = 500; global $mod_strings; global $mod_list_strings; global $app_strings; global $app_list_strings; global $current_user; global $import_file_name; global $upload_maxsize; global $root_directory; global $import_dir; $focus_impacc = new ImportAccount(); $focus_imppro = new ImportProduct(); $focus_impso = new ImportSalesorder(); $focus = 0; $delimiter = ','; $max_lines = 3; $has_header1 = 1; $overwrite1 = 1; $has_header2 = 1; $overwrite2 = 1; global $theme; $theme_path = "themes/" . $theme . "/"; $image_path = $theme_path . "images/"; require_once $theme_path . 'layout_utils.php'; $smarty = new CRMSmarty(); $smarty->assign("MOD", $mod_strings); $smarty->assign("APP", $app_strings);