function push_alter_product_data_to_server($array) { if (sizeof($array) == 0) { return; } $receipt = new Receipt(); $array_id = array(); foreach ($array as $product) { if (isset($product['id'])) { if (strcmp($product['action'], 'Xóa sản phẩm') == 0) { $array_id[] = $product['id']; } else { $import_product = new ImportProduct($product['bought']); $import_product->add_attribute($product['name'], new Unit($product['unit_name'], $product['sale']), $product['id']); $receipt->add($import_product); } } } $manage = new Management(); $manage->remove_product($array_id); $manage->push_alter_product_data_to_server($receipt); }