<?php

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

$formname = 'Other Receipt';
$maindb = 'othrecp';
//$trandb = 'saletran';
$file = 'othrecp_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 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);

mysqli_select_db($conn, $zdb);

$gcust = mysqli_query($conn, "SELECT * FROM `accmast` WHERE `accode`=$getmdata[party]") or die(mysqli_error($conn));
$cust = mysqli_fetch_array($gcust);

require("library/fpdf/fpdf.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, 10, 'Page ' . $this->PageNo() . '/{nb}', 0, 0, 'C');
    }

}

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

$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', 18);
$pdf->SetTextColor(0, 0, 0);

    $pdf->SetFont('Arial', 'B', 8);
    $pdf->Cell(193, 6, "Subject To Mumbai Jurisdiction", 'TRL', 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('Arial', 'B', 15);
    $pdf->Cell(193, 6, "$getcmpname[pname]", 'RL', 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->Cell(193, 6, "$getcmpname[add1]  $getcmpname[add2]  $getcmpname[add3] ", 'LR', 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('Arial', '', 12);
    $pdf->Cell(193, 6, "Email : $getcmpname[email] Tel: $getcmpname[tel] Mobile : $getcmpname[mobile]", 'LR', 0, 'C');
    $pdf->Ln();
    $pdf->SetFont('Arial', 'B', 10);
    $pdf->Cell(193, 6, "$formname", 'LRB', 0, 'C');
    $pdf->Ln(10);



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

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

$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(55, 1, "Received with thanks from", 0, 0);
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(103, 1, "$cust[name]", 0, 0);

// $pdf->Cell(13, 1, "Rs. ", 0, 0);
// $pdf->SetFont('Arial', 'B', 12);
$pdf->Ln(10);

$pdf->SetFont('Arial', '', 12);
$pdf->Cell(23, 1, "a amount of ", 0, 0);
$pdf->SetFont('Arial', '', 12);
$pdf->Cell(103, 1, "Rs. $getmdata[amount]", 0, 0);
// $pdf->Cell(27, 1, "$getmdata[sonamt]", 0, 0)
$pdf->Ln(50);

$pdf->SetFont('Arial', 'B', 10);
$pdf->Cell(20, 1, "_______________________", 0, 0);
$pdf->Cell(92, 1, " ", 0, 0);
$pdf->SetFont('Arial', 'B', 11);
$pdf->Cell(70, 1, "___________________________", 0, 0);
$pdf->Ln(10);
$pdf->SetFont('Arial', 'B', 11);
// $pdf->Cell(103, 1, "$getmdata[narration]", 0, 0);
$pdf->Cell(20, 1, "Authorised Signatory", 0, 0);
$pdf->Cell(92, 1, " ", 0, 0);
$pdf->Cell(75, 1, "Received By/ Account Holder", 0, 0);



$pdf->SetFont('Arial', 'B', 10);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFillColor(225, 225, 225);
$cl = 8;


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

// // $pdf->Line(20, 150, 100, 150);

// // $pdf->Line(110, 150, 193, 150);

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



$pdf->Ln(10);

//$pdf->AddPage();
//
//
//$img = "images/terms.jpg";
//$pdf->Image("$img", 20, 12, 170, 250, 'JPEG');

$y_aqui2 = $pdf->Gety();

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