function replaceWarehousesProductsList($pdftype, $id, $templateid, $content, $tcpdf)
{
    $current_language = Users_Record_Model::getCurrentUserModel()->get('language');
    include "languages/" . $current_language . "/OSSPdf.php";
    require_once 'include/utils/CommonUtils.php';
    require_once 'include/fields/CurrencyField.php';
    require_once 'vtiger6/modules/OSSWarehouses/views/Utils.php';
    require_once 'modules/' . $pdftype . '/' . $pdftype . '.php';
    require_once 'Smarty_setup.php';
    $smarty = new Vtiger_Viewer();
    GetProducts($pdftype, $id, $smarty);
    $smarty->assign('MODULE', $pdftype);
    return $smarty->fetch('modules/OSSWarehouses/ProductTablePDF.tpl');
}
Example #2
0
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-type: application/json");
header("access-control-allow-origin: *");
$method = $_SERVER['REQUEST_METHOD'];
//// REST Decoder
// evaluate method
switch ($method) {
    case 'PUT':
        UpdateProduct();
        break;
    case 'POST':
        SaveProduct();
        break;
    case 'GET':
        GetProducts();
        break;
    case 'HEAD':
        echo "HEAD";
        break;
    case 'DELETE':
        DeleteProduct();
        break;
    case 'OPTIONS':
        echo "OPTIONS";
        break;
    default:
        echo "{$method}";
        break;
}
//// DB
$result = mysql_query("SELECT \t\tCONCAT(production_category.`name`, '<br>', ROUND(SUM(sale_transaction_detail.product_quantity*sale_transaction_detail.cost),2), ' ლ  ', '(',SUM(sale_transaction_detail.product_quantity),'ც)') AS `category_name`,\r\n\t\t\t\t\tSUM(sale_transaction_detail.product_quantity*sale_transaction_detail.cost) AS `quantity`\r\n\t\t\t\t\tFROM sale_transaction\r\n\t\t\t\t\tLEFT JOIN sale_transaction_detail ON sale_transaction.id = sale_transaction_detail.transaction_id\r\n\t\t\t\t\tLEFT JOIN production ON production.id = sale_transaction_detail.production_id\r\n\t\t\t\t\tLEFT JOIN production_category ON production.category = production_category.id\r\n\t\t\t\t\tWHERE production_category.`name` IS NOT NULL AND `sale_transaction`.`status`=0 AND DATE(`sale_transaction`.`end_date`) >= '{$start}' AND DATE(`sale_transaction`.`end_date`) <= '{$end}'\r\n\t\t\t\t\tGROUP BY production.`category`");
function GetProducts($name, $start, $end)
{
    $res = mysql_query("SELECT \tCONCAT(production.`name`, '<br>', ROUND(SUM(sale_transaction_detail.product_quantity*sale_transaction_detail.cost),2), ' ლ ', '(',SUM(sale_transaction_detail.product_quantity),'ც)') AS `prod_name`,\r\n\t\t\tSUM(sale_transaction_detail.product_quantity*sale_transaction_detail.cost) AS `quantity`\r\n\t\t\tFROM sale_transaction\r\n\t\t\tLEFT JOIN sale_transaction_detail ON sale_transaction.id = sale_transaction_detail.transaction_id\r\n\t\t\tLEFT JOIN production ON production.id = sale_transaction_detail.production_id\r\n\t\t\tLEFT JOIN production_category ON production.category = production_category.id\r\n\t\t\tWHERE production_category.`name` = '{$name}' AND `sale_transaction`.`status`=0 AND DATE(`sale_transaction`.`end_date`) >= '{$start}' AND DATE(`sale_transaction`.`end_date`) <= '{$end}'\r\n\t\t\tGROUP BY production.`name`");
    return $res;
}
switch ($action) {
    case 'get_category':
        $rows = array();
        while ($r = mysql_fetch_array($result)) {
            $row[0] = $r[0];
            $row[1] = $r[1];
            array_push($rows, $row);
        }
        print json_encode($rows, JSON_NUMERIC_CHECK);
        break;
    case 'get_products':
        $name = $_REQUEST['name'];
        $res = GetProducts($name, $start, $end);
        $rows = array();
        while ($r = mysql_fetch_array($res)) {
            $row[0] = $r[0];
            $row[1] = $r[1];
            array_push($rows, $row);
        }
        print json_encode($rows, JSON_NUMERIC_CHECK);
        break;
    default:
        echo "Action Is Null!";
        break;
}
Example #4
0
function pageee($my)
{
    if ($my[2] == '') {
        $start = 1;
        $disable = '';
    } else {
        $start = $my[2];
        $disable = 'disabled';
    }
    $data = '
			<div id="dialog-form">
		 	    <fieldset>
					<legend>პროდუქტი</legend>
					<table>
						<tr>
							  <td style="width:120px; padding-top: 5px;">დასახელება</td>
                              <td>

            						<select style="width: 300px;" ' . $disable . ' id="production_name">' . GetProducts($my[0]) . '</select>

                			  </td>
                        </tr>
            		    <tr>
							  <td style="width:120px; padding-top: 5px;">ფასთა ჯგუფი</td>
                              <td>

            						<select style="width: 300px;" ' . $disable . ' id="price_group">
            						        <option value="1">1</option>
                                            <option value="2">2</option>
                						    <option value="3">3</option>
                						    <option value="4">4</option>
                						    <option value="5">5</option>
                						    <option value="6">6</option>
                						    <option value="7">7</option>
                						    <option value="8">8</option>
                						    <option value="9">9</option>
                						    <option value="10">10</option>
            						        <option value="11">11</option>
                                    </select>

                			  </td>
                        </tr>
            						    
            			<tr>
							  <td style="width:120px; padding-top: 5px;">ფასი</td>
                              <td>
                                    <input style="width: 40px;" type="text" id="prod_price" value="" >
                			  </td>
                        </tr>
                        <tr>
                              <td style="width:120px; padding-top: 25px;">რაოდენობა</td>
                              <td style="padding-top: 20px;">
            						<input style="width: 40px;" type="number" id="prod_count" value="' . $start . '" min="1">
                			  </td>
                		</tr>	
            		</table>
		        </fieldset>
						<input  type="hidden" id="hidden_prod_id" value="' . $my[0] . '^' . $start . '"/>
                        <input  type="hidden" id="hidden_prod_id_or" value="' . $my[0] . '"/>
                        <input  type="hidden" id="change" value="' . $my[0] . '"/>
                        
						
		    </div> <script>$(document).ready(function () {$(".add_product-class").css("top","0");});</script>';
    return $data;
}