<?php
$zroot = $_SESSION["zdir"];
$zcomp = $_SESSION["comp_" . $dbname];
$getcomp = mysqli_query($conn, "SELECT * FROM $zroot.`company` where code = '$zcomp' ") or die(mysqli_error($conn));
$comp = mysqli_fetch_array($getcomp);

$contents .= ",$comp[pname] \n";

$add1 = str_replace(",", " ", "$comp[add1]");
$add2 = str_replace(",", " ", "$comp[add2]");
$add3 = str_replace(",", " ", "$comp[add3]");

$contents .= ", $add1 $add2 $add3 \n \n";

$repdate = Date("d-m-Y");
$contents .= "$formname -  $partyprinname , Report Date - $repdate \n";
    
             if ($mfdt != '') {
                $contents .= "From Date - $mfdt,"; 
            } 
            if ($mtdt != '') { 
                $contents .= "To Date - $mtdt \n";     
             } 
        
    if ($dtype == 1) {
        $rtype = "Summary";
    } elseif ($dtype == 2) {
        $rtype = "Detail";
    } elseif ($dtype == '') {
        $rtype = '';
    }

    if ($dtype > 0) {
    $contents .= "$rtype \n";
     }