Esempio n. 1
0
function show_concat_waste($ref_sell, $price_call)
{
    mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    mysql_select_db('dbs3') or die(mysql_error());
    $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' GROUP BY type_item ORDER By type_item";
    //echo $ref_sell;
    $reuse = array();
    $cust = add_db($customer1);
    $waste_barcode = array();
    $waste_barcode_weight = array();
    //echo "bf fetch";
    while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
        //changed from 1
        $i++;
        //echo " in fetch ";
        //if($tab[$rek["id_test"]]<'1')
        //{
        //here we count unige barcode waste and add to array
        $index = $rek['type_item'];
        // echo " <BR /> ";
        $waste_barcode[$index] += $rek['quantity'];
        $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
        //echo '<tr>';
        //echo '<td>'.get_item_name($rek['type_item']).'</td>';
        // echo '<td>'.$rek["quantity"].'</td>';
        // echo '<td>'.$rek["category"].'</td>';
        //   echo '<td>'.$rek["pn"].'.</td>';
        //     	echo '<td>1</td>';
        //echo '<td>'.$rek["sum_weight"].'</td>';
        // echo '<td>'.$rek["Name_sub"].'</td>';
        //echo '</tr>';
        $cat = $rek['category'];
        $reuse[$cat] += $rek['weight'] * $rek['quantity'];
        //}
        //$tab[$rek["id_test"]]+=1;
    }
    $waste_barcode[3];
    $waste_barcode_weight[3];
    echo '<form action="sell_item_invoice_waste.php?invoice=1&ref_sell=' . $ref_sell . '" method="POST">';
    $weee_reused_waste_qtty = array();
    global $sum_rec;
    global $qtty_rec;
    global $ind_rec;
    for ($name_cat = 0; $name_cat < 62; $name_cat++) {
        if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
            echo "<tr>";
            echo "<td>";
            echo $sum_qtty_recalculate = $qtty + $waste_barcode[$name_cat];
            echo " UNIT </td>";
            echo "<td>";
            echo get_item_name($name_cat);
            echo "</td>";
            // echo '<td>';
            // echo get_weight_qtty($ref_sell, $name_cat)+$waste_barcode_weight[$name_cat];
            //    echo "</td>";
            //    echo "<td>".$name_cat."</td>";
            echo "<td>" . $sum_qtty_recalculate . " x </td>";
            // echo $sum_rec[$name_cat];
            echo "<input type='hidden' name='qtty_rec" . $name_cat . "' value='" . $sum_qtty_recalculate . "'>";
            echo "<td><input type='text' name='price" . $name_cat . "' value='" . $ind_rec[$name_cat] . "' placeholder='Individual price'></td>";
            if ($sum_rec[$name_cat] > 0) {
                echo "<td> <b>Price Set:</b> <BR/>" . $sum_rec[$name_cat] . " Pounds</td>";
            }
            echo "</tr>";
            $sum_qtty = get_weight_qtty($ref_sell, $name_cat);
            +$waste_barcode[$name_cat];
            $cat = get_cat($name_cat);
            $weee_reused_waste_qtty[$cat] += get_weight_qtty($ref_sell, $name_cat);
        } else {
            $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' AND type_item='{$name_cat}' GROUP BY type_item ORDER By type_item";
            $cust = add_db($customer1);
            while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
                $i++;
                //if($tab[$rek["id_test"]]<'1')
                //{
                //here we count unige barcode waste and add to array
                if ($rek['quantity'] > 0) {
                    $qtty_indiv = $rek["quantity"];
                    $index = $rek['type_item'];
                    $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
                    // echo " <BR /> ";
                    //$waste_barcode[$index]+=$rek['quantity'];
                    // $waste_barcode_weight[$index]=$rek['weight']*$rek['quantity'];
                    echo '<tr>';
                    echo '<td>' . $rek["quantity"] . ' Unit</td>';
                    echo '<td>' . get_item_name($rek['type_item']) . '</td>';
                    //   echo '<td>'.$waste_barcode_weight[$index]
                    //   .'</td>';
                    //  echo '<td>'.$rek["category"].'</td>';
                    // echo '<td>'.$rek["pn"].'.</td>';
                    //      	echo '<td>1</td>';
                    //echo '<td>'.$rek["sum_weight"].'</td>';
                    // echo '<td>'.$rek["Name_sub"].'</td>';
                    echo "<td>" . $qtty_indiv . " x </td>";
                    echo "<input type='hidden' name='qtty_rec" . $name_cat . "' value='" . $qtty_indiv . "'>";
                    echo "<td><input type='text' name='price" . $name_cat . "' value='" . $ind_rec[$name_cat] . "' placeholder='Individual price'></td>";
                    if ($sum_rec[$name_cat] > 0) {
                        echo "<td> <b>Price Set:</b> <BR/>" . $sum_rec[$name_cat] . " Pounds</td>";
                    }
                    echo '</tr>';
                    //  $cat=$rek['category'];
                    //  $reuse[$cat]+=$rek['weight'] * $rek['quantity'];
                    //}
                }
                //$tab[$rek["id_test"]]+=1;
            }
        }
    }
    global $sum_price;
    global $price_invoice_set;
    if ($sum_price > 0) {
        echo "<tr></tr>";
        echo "<tr><td colspan='4'></td><td> <b>Total value: " . $sum_price . "</b></td></tr>";
        echo "<input type='hidden' name='sum_set' value='" . $sum_price . "'";
        $price_invoice_set = $sum_price;
    }
    echo '<tr><input type="Submit" name="Recalculate" value="Recalculate"></tr>';
    echo '<BR />';
    echo '</form>';
}
Esempio n. 2
0
        echo '<tr><td>';
        echo weee_ext_name($id_ext);
        echo "</td><td> ";
        echo $sum;
        echo " Unit </td></tr>";
    }
}
?>
</table>

<table>

    <?php 
$weee_reused_waste_qtty = array();
for ($name_cat = 0; $name_cat < 62; $name_cat++) {
    if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
        //echo "<tr>";
        //echo "<td>";
        $qtty + $waste_barcode[$name_cat];
        //echo " UNIT </td>";
        //echo "<td>";
        get_item_name($name_cat);
        // echo "</td>";
        // echo '<td>';
        get_weight_qtty($ref_sell, $name_cat) + $waste_barcode_weight[$name_cat];
        // echo "</td>";
        //  echo "<td>".$name_cat."</td>";
        //  echo  "</tr>";
        $sum_qtty = get_weight_qtty($ref_sell, $name_cat);
        +$waste_barcode[$name_cat];
        $cat = get_cat($name_cat);
Esempio n. 3
0
function show_concat_waste_swaped($ref_sell)
{
    mysql_connect('localhost', 'root', 'krasnal') or die(mysql_error());
    mysql_select_db('dbs3') or die(mysql_error());
    $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' GROUP BY type_item ORDER By type_item";
    //echo $ref_sell;
    $reuse = array();
    $cust = add_db($customer1);
    $waste_barcode = array();
    $waste_barcode_weight = array();
    //echo "bf fetch";
    while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
        //changed from 1
        $i++;
        //echo " in fetch ";
        //if($tab[$rek["id_test"]]<'1')
        //{
        //here we count unige barcode waste and add to array
        $index = $rek['type_item'];
        // echo " <BR /> ";
        $waste_barcode[$index] += $rek['quantity'];
        $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
        //echo '<tr>';
        //echo '<td>'.get_item_name($rek['type_item']).'</td>';
        // echo '<td>'.$rek["quantity"].'</td>';
        // echo '<td>'.$rek["category"].'</td>';
        //   echo '<td>'.$rek["pn"].'.</td>';
        //     	echo '<td>1</td>';
        //echo '<td>'.$rek["sum_weight"].'</td>';
        // echo '<td>'.$rek["Name_sub"].'</td>';
        //echo '</tr>';
        $cat = $rek['category'];
        $reuse[$cat] += $rek['weight'] * $rek['quantity'];
        //}
        //$tab[$rek["id_test"]]+=1;
    }
    $waste_barcode[3];
    $waste_barcode_weight[3];
    $weee_reused_waste_qtty = array();
    for ($name_cat = 0; $name_cat < 62; $name_cat++) {
        if (($qtty = get_waste_qtty($ref_sell, $name_cat)) > 0) {
            echo "<tr>";
            echo "<td>";
            echo get_item_name($name_cat);
            echo "</td>";
            echo "<td>";
            echo $qtty + $waste_barcode[$name_cat];
            echo " UNIT </td>";
            // echo '<td>';
            // echo get_weight_qtty($ref_sell, $name_cat)+$waste_barcode_weight[$name_cat];
            //    echo "</td>";
            //    echo "<td>".$name_cat."</td>";
            echo "</tr>";
            $sum_qtty = get_weight_qtty($ref_sell, $name_cat);
            +$waste_barcode[$name_cat];
            $cat = get_cat($name_cat);
            $weee_reused_waste_qtty[$cat] += get_weight_qtty($ref_sell, $name_cat);
        } else {
            $customer1 = "SELECT waste_barcode.category,waste_barcode.weight,type_item,count(*) as quantity FROM transaction_waste, waste_barcode,item_has_cat Where waste_barcode.idwaste_barcode=transaction_waste.waste_barcode_idwaste_barcode " . "AND Item_has_cat.id_item_cat=waste_barcode.type_item AND ref_sell_number='{$ref_sell}' AND type_item='{$name_cat}' GROUP BY type_item ORDER By type_item";
            $cust = add_db($customer1);
            while ($rek = mysql_fetch_array($cust, MYSQL_BOTH)) {
                $i++;
                //if($tab[$rek["id_test"]]<'1')
                //{
                //here we count unige barcode waste and add to array
                if ($rek['quantity'] > 0) {
                    $index = $rek['type_item'];
                    $waste_barcode_weight[$index] = $rek['weight'] * $rek['quantity'];
                    // echo " <BR /> ";
                    //$waste_barcode[$index]+=$rek['quantity'];
                    // $waste_barcode_weight[$index]=$rek['weight']*$rek['quantity'];
                    echo '<tr>';
                    echo '<td>' . get_item_name($rek['type_item']) . '</td>';
                    echo '<td>' . $rek["quantity"] . ' UNIT</td>';
                    //   echo '<td>'.$waste_barcode_weight[$index]
                    //   .'</td>';
                    //  echo '<td>'.$rek["category"].'</td>';
                    // echo '<td>'.$rek["pn"].'.</td>';
                    //      	echo '<td>1</td>';
                    //echo '<td>'.$rek["sum_weight"].'</td>';
                    // echo '<td>'.$rek["Name_sub"].'</td>';
                    echo '</tr>';
                    //  $cat=$rek['category'];
                    //  $reuse[$cat]+=$rek['weight'] * $rek['quantity'];
                    //}
                }
                //$tab[$rek["id_test"]]+=1;
            }
        }
    }
}