<?php

require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include ('includes/function.php');

$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn, $zdb);

if (isset($_REQUEST["party"])) {
    $maccode = $_REQUEST['party'];

    $querysales = mysqli_query($conn, "SELECT `discount`, `packing`, `paid` FROM `accmast` WHERE `accode` ='$maccode'") or die(mysqli_error($conn));

    $rows = array();
    $ctr = 0;
    $r =  mysqli_fetch_array($querysales) or die(mysqli_error($conn));
    $discount = $r['discount'];
    $packing = $r['packing'];
    $paid = $r['paid'];

    $rows = array('success' => true, 'discount'=>$discount, 'packing'=>$packing, 'paid'=>$paid);
    
    header("Content-type: application\json");
    echo json_encode($rows);
}