<?php

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

$formname = 'Medical Help';
$maindb = 'medihelp';
$file = 'medihelp_pdf.php';
$source = "";
$zcomp = $_SESSION["comp_" . $dbname];
$fseries = $_SESSION["series_" . $dbname];

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

$mht = 'height:20px;';
$admin = $_SESSION["admin_" . $dbname];
$vouchno = $_REQUEST["vouchno"];

$mainqry = mysqli_query($conn, "SELECT *, DATE_FORMAT(`vouchdt`, '%d-%m-%Y') AS vouchdt, DATE_FORMAT(`sancdt`, '%d-%m-%Y') AS sancdt 
                                FROM `$maindb` WHERE `vouchno`='$vouchno' ORDER BY `vouchno`") or die(mysqli_error($conn));
$getmdata = mysqli_fetch_array($mainqry) or die(mysqli_error($conn));

$cmpname = mysqli_query($conn, "SELECT * From $zroot.`company` where code ='$zcomp'")or die(mysqli_error($conn));
$getcmpname = mysqli_fetch_array($cmpname);


require("library/fpdf/dash.php");

class pdf extends fpdf {

    function Footer() {

//Position at 1.5 cm from bottom
        $this->SetY(-15);

//Arial italic 8
        $this->SetFont('Arial', 'I', 8);
//Page number
        // $this->Cell(0, 0, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }

}

$pdf = new PDF_Dash('P', 'mm', 'A4');

$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial', 'BI', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(193, -9, "Personal Copy", 0, 0, 'R');
$pdf->Ln(1);

    $pdf->SetFont('Arial', 'B', 15);
    $pdf->Cell(193, 0, "SORATHIYA MUSLIM GHANCHI JAMAT TRUST (MUMBAI)", 0, 0, 'C');
    $pdf->Ln(2);
    $pdf->SetFont('Arial', 'B', 12);
    $pdf->Cell(193, 6, "Regd. 1950 No. B.1184 Dt. 9-4-1970", 0, 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('Arial', '', 12);
    $pdf->Cell(193, 6, "131, Zakaria Masjid Street, Mumbai - 400 001. Phone: 022-23456741", 0, 0, 'C');
    $pdf->Ln(8);



$pdf->SetFont('Arial', 'B', 15);
$pdf->SetTextColor(169, 185, 124);
$pdf->SetFillColor(169, 185, 124);
$pdf->Cell(193, 7, "$formname", 0, 0, 'C');
$pdf->Ln(12);

$pdf->Line(10, 25, 203, 25);

$pdf->SetFillColor(225, 225, 225);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 2, "Voucher  ", 0, 0);
$pdf->Cell(5, 2, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(115, 2, "$getmdata[vouchno]", 0, 0);

$pdf->SetFont('Arial', '', 12);
$pdf->Cell(13, 1, "Date : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(27, 1, "$getmdata[vouchdt]", 0, 0);
$pdf->Ln(8);

$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);

$pdf->SetDrawColor(206, 169, 98);
$pdf->SetFont('Arial', '', 12);
$pdf->SetDrawColor(0, 0, 0);

$pdf->Cell(28, 1, "Member Code", 0, 0);
$pdf->Cell(5, 1, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(27, 1, "$getmdata[memno]", 0, 0);
$pdf->SetFont('Arial', '', 12);
$pdf->Cell(5, 1, "Name :", 0, 0,'R');
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(88, 1, "$getmdata[memname]", 0, 0,'L');

$pdf->Ln(8);

$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "Address ", 0, 0);
$pdf->Cell(5, 0, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 1, "$getmdata[add1]", 0, 0);
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(33, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[add2]", 0, 0);
$pdf->Ln(5); 
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(33, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[add3]", 0, 0);
$pdf->Ln(8); 

$pdf->SetFillColor(225, 225, 225);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 2, "Mobile No. ", 0, 0);
$pdf->Cell(5, 2, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(115, 2, "$getmdata[mobile]", 0, 0);

$pdf->Ln(8);


$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "Reason ", 0, 0);
$pdf->Cell(5, 0, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 1, "$getmdata[reqreason]", 0, 0);
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "", 0, 0);
$pdf->Cell(5, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[reqreason2]", 0, 0);
$pdf->Ln(8);

$time = date('h:i A', strtotime($getmdata['engtime']));


$pdf->SetFillColor(225, 225, 225);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 2, "Sanctioned", 0, 0);
$pdf->Cell(5, 2, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(95, 2, "Rs. $getmdata[sancamt]", 0, 0);

$pdf->SetFont('Arial', '', 12);
$pdf->Cell(35, 1, "Sanctioned Date : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(27, 1, "$getmdata[sancdt]", 0, 0);
$pdf->Ln(8);

$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "Remarks ", 0, 0);
$pdf->Cell(5, 0, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 1, "$getmdata[remark1]", 0, 0);
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "", 0, 0);
$pdf->Cell(5, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[remark2]", 0, 0);
$pdf->Ln(27);


$pdf->SetFont('Arial', '', 10);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0, 0, 0);

$pdf->Line(20, 130, 100, 130);

$pdf->Line(110, 130, 193, 130);

$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(70, 0, "Authorised Signatory ", '', 0, 'R', 1);
$pdf->Cell(105, 0, "Received By / Account Holder", '', 0, 'R', 1);



$pdf->Ln(15);


$pdf->SetLineWidth(0.1);
$pdf->SetDash(1,1);
$pdf->Line(10, 142, 203, 142);
$pdf->Ln();

$pdf->SetFont('Arial', 'BI', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(193, 0, "Office Copy", 0, 0, 'R');
$pdf->Ln(7);

    $pdf->SetFont('Arial', 'B', 15);
    $pdf->Cell(193, 0, "SORATHIYA MUSLIM GHANCHI JAMAT TRUST (MUMBAI)", 0, 0, 'C');
    $pdf->Ln(3);
    $pdf->SetFont('Arial', 'B', 12);
    $pdf->Cell(193, 6, "Regd. 1950 No. B.1184 Dt. 9-4-1970", 0, 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('Arial', '', 12);
    $pdf->Cell(193, 6, "131, Zakaria Masjid Street, Mumbai - 400 001. Phone: 022-23456741", 0, 0, 'C');
    $pdf->Ln(7);



$pdf->SetFont('Arial', 'B', 15);
$pdf->SetTextColor(169, 185, 124);
$pdf->SetFillColor(169, 185, 124);
$pdf->Cell(193, 7, "$formname", 0, 0, 'C');
$pdf->Ln(12);

$pdf->SetLineWidth(0);
$pdf->SetDash(0,0);
$pdf->Line(10, 172, 203, 172);

$pdf->SetFillColor(225, 225, 225);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 2, "Voucher  ", 0, 0);
$pdf->Cell(5, 2, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(115, 2, "$getmdata[vouchno]", 0, 0);

$pdf->SetFont('Arial', '', 12);
$pdf->Cell(13, 1, "Date : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(27, 1, "$getmdata[vouchdt]", 0, 0);
$pdf->Ln(8);

$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);

$pdf->SetDrawColor(206, 169, 98);
$pdf->SetFont('Arial', '', 12);
$pdf->SetDrawColor(0, 0, 0);

$pdf->Cell(28, 1, "Member Code", 0, 0);
$pdf->Cell(5, 1, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(27, 1, "$getmdata[memno]", 0, 0);
$pdf->SetFont('Arial', '', 12);
$pdf->Cell(5, 1, "Name :", 0, 0,'R');
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(88, 1, "$getmdata[memname]", 0, 0,'L');

$pdf->Ln(8);

$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "Address ", 0, 0);
$pdf->Cell(5, 0, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 1, "$getmdata[add1]", 0, 0);
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(33, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[add2]", 0, 0);
$pdf->Ln(5); 
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(33, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[add3]", 0, 0);
$pdf->Ln(8); 

$pdf->SetFillColor(225, 225, 225);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 2, "Mobile No. ", 0, 0);
$pdf->Cell(5, 2, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(115, 2, "$getmdata[mobile]", 0, 0);

$pdf->Ln(8);


$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "Reason ", 0, 0);
$pdf->Cell(5, 0, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 1, "$getmdata[reqreason]", 0, 0);
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "", 0, 0);
$pdf->Cell(5, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[reqreason2]", 0, 0);
$pdf->Ln(8);

$time = date('h:i A', strtotime($getmdata['engtime']));


$pdf->SetFillColor(225, 225, 225);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 2, "Sanctioned", 0, 0);
$pdf->Cell(5, 2, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(95, 2, "Rs. $getmdata[sancamt]", 0, 0);

$pdf->SetFont('Arial', '', 12);
$pdf->Cell(35, 1, "Sanctioned Date : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(27, 1, "$getmdata[sancdt]", 0, 0);
$pdf->Ln(8);

$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "Remarks ", 0, 0);
$pdf->Cell(5, 0, " : ", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 1, "$getmdata[remark1]", 0, 0);
$pdf->Ln(5);
$pdf->SetFont('Arial', '', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(28, 0, "", 0, 0);
$pdf->Cell(5, 0, "", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(170, 0, "$getmdata[remark2]", 0, 0);
$pdf->Ln(49);

$pdf->SetFont('Arial', '', 10);
$pdf->SetFillColor(255, 255, 255);
$pdf->SetTextColor(0, 0, 0);

$pdf->Line(20, 285, 100, 285);

$pdf->Line(110, 285, 193, 285);

$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(70, -25, "Authorised Signatory ", '', 0, 'R');
$pdf->Cell(105, -25, "Received By / Account Holder", '', 0, 'R');


$y_aqui2 = $pdf->Gety();

ob_end_clean();
$pdf->Output("$formname - $lparty[name]-" . $getmdata['vouchno'] . ".pdf", "I");
?>