<?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 * FROM `accmast` WHERE `accode` ='$maccode'") or die(mysqli_error($conn));

    $rows = array();
    $ctr = 0;
    $r =  mysqli_fetch_array($querysales) or die(mysqli_error($conn));
    $shipname = $r['name'];
    $shipadd1 = $r['add1'];
    $shipadd2 = $r['add2'];
    $shipadd3 = $r['add3'];
    $shipgstno = $r['gstno'];

    $rows = array('success' => true,
                  'shipname'=>$shipname, 
                  'shipgstno'=>$shipgstno, 
                  'shipadd1'=>$shipadd1,
                  'shipadd2'=>$shipadd2,
                  'shipadd3'=>$shipadd3);
    
    header("Content-type: application\json");
    echo json_encode($rows);
}