Pierwszy commit - dodawanie plików
This commit is contained in:
commit
59d87eabc5
23
123.php
Normal file
23
123.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// Create a test source image for this example
|
||||
$im = imagecreatetruecolor(300, 50);
|
||||
$text_color = imagecolorallocate($im, 233, 14, 91);
|
||||
imagestring($im, 1, 5, 5, 'A Simple Text String', $text_color);
|
||||
|
||||
// start buffering
|
||||
ob_start();
|
||||
// output jpeg (or any other chosen) format & quality
|
||||
imagejpeg($im, NULL, 85);
|
||||
// capture output to string
|
||||
$contents = ob_get_contents();
|
||||
// end capture
|
||||
ob_end_clean();
|
||||
|
||||
// be tidy; free up memory
|
||||
imagedestroy($im);
|
||||
|
||||
// lastly (for the example) we are writing the string to a file
|
||||
$fh = fopen("./images/malcomm.jpg", "a+" );
|
||||
fwrite( $fh, $contents );
|
||||
fclose( $fh );
|
||||
?>
|
||||
41
abc.php
Normal file
41
abc.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "select a.data As Data,a.nrzlecenia As Nr_zlecenia,b.nazwisko As Nazwisko,b.imie As Imie,c.akcja As Akcja,d.bank As Bank,a.ulica As Ulica,a.miejscowosc As Miejscowosc,a.nrseryjny As Nr_seryjny,a.typ As Typ,a.dopuszczony As Dopuszczono,a.zrobiony As Zrobiono,a.przystapiono As Przystapiono from raporty a,uzytkownicy b,akcja c,bank d where a.id=b.id and a.id_akc=c.id_akc and a.id_ban=d.id_ban and a.usun='0' order by a.data desc";
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value)) OR ($value == "")) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\n(0) Records Found!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=Harmonogram " . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
172
compress.php
Normal file
172
compress.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
$excl = array( 'HTML-CSS', 'DIRECTW', 'TABLES', 'LISTS', 'IMAGES-CORE',
|
||||
'IMAGES-BMP', 'IMAGES-WMF', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'COLUMNS', 'TOC', 'INDEX', 'BOOKMARKS', 'BARCODES', 'FORMS', 'WATERMARK', 'CJK-FONTS', 'RTL', 'INDIC', 'ANNOTATIONS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS', 'HYPHENATION', 'ENCRYPTION', 'IMPORTS', 'PROGRESS-BAR');
|
||||
|
||||
|
||||
// *DIRECTW* = Write, WriteText, WriteCell, Text, Shaded_box, AutosizeText
|
||||
// IMAGES-CORE = [PNG, GIF, and JPG] NB background-images and watermark images
|
||||
|
||||
// Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS'
|
||||
|
||||
// Text is marked in mpdf_source.php with e.g. :
|
||||
/*-- TABLES-ADVANCED-BORDERS --*/
|
||||
/*-- END TABLES-ADVANCED-BORDERS --*/
|
||||
// *TABLES-ADVANCED-BORDERS*
|
||||
|
||||
|
||||
if (!isset($_POST['generate']) || $_POST['generate']!='generate') {
|
||||
|
||||
|
||||
if (!file_exists('mpdf_source.php')) {
|
||||
die("ERROR - Could not find mpdf_source.php file in current directory. Please rename mpdf.php as mpdf_source.php");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<html>
|
||||
<head>
|
||||
<script language=javascript>
|
||||
checked=false;
|
||||
function checkedAll (frm1) {
|
||||
var aa= document.getElementById("frm1");
|
||||
if (checked == false)
|
||||
{
|
||||
checked = true
|
||||
}
|
||||
else
|
||||
{
|
||||
checked = false
|
||||
}
|
||||
for (var i =0; i < aa.elements.length; i++)
|
||||
{
|
||||
aa.elements[i].checked = checked;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<p><span style="color:red; font-weight: bold;">WARNING</span>: This utility will OVERWRITE mpdf.php file in the current directory.</p>
|
||||
<p>Select the functions you wish to INCLUDE in your mpdf.php program. When you click generate, a new mpdf.php file will be written to the current directory.</p>
|
||||
<div><b>Notes</b>
|
||||
<ul>
|
||||
<li>HTML-CSS is required for many of the other functions to work including: Tables, Lists, Backgrounds, Forms, Border-radius and all other CSS</li>
|
||||
<li>DIRECTW includes the functions to Write directly to the PDF file e.g. Write, WriteText, WriteCell, Text, Shaded_box, AutosizeText</li>
|
||||
<li>You must include either HTML-CSS or DIRECTW</li>
|
||||
<li>JPG, PNG and JPG images are supported with IMAGES-CORE</li>
|
||||
<li>For WMF Images, you must include both IMAGES-CORE and IMAGES-WMF</li>
|
||||
<li>IMAGES-CORE are required for BACKGROUNDS (IMAGES) or WATERMARKS to work</li>
|
||||
</ul>
|
||||
</div>
|
||||
<input type="checkbox" name="checkall" onclick="checkedAll(frm1);"> <i>Select/Unselect All</i><br /><br />
|
||||
|
||||
<form id="frm1" action="compress.php" method="POST">
|
||||
';
|
||||
foreach($excl AS $k=>$ex) {
|
||||
echo '<input type="checkbox" value="1" name="inc['.$ex.']"';
|
||||
if ($k==0 || ($k > 1 && $k < 5)) {
|
||||
echo ' checked="checked"';
|
||||
}
|
||||
echo ' /> '.$ex.'<br />';
|
||||
}
|
||||
|
||||
echo '<br />
|
||||
<input type="submit" name="generate" value="generate" />
|
||||
</form>
|
||||
</body>
|
||||
</html>';
|
||||
exit;
|
||||
}
|
||||
|
||||
$inc = $_POST['inc'];
|
||||
if (is_array($inc) && count($inc)>0 ) {
|
||||
foreach($inc AS $i=>$v) {
|
||||
$key = array_search($i, $excl);
|
||||
unset($excl[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!defined('PHP_VERSION_ID')) {
|
||||
$version = explode('.', PHP_VERSION);
|
||||
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
|
||||
}
|
||||
if (PHP_VERSION_ID < 50300) { $mqr = @get_magic_quotes_runtime(); }
|
||||
else { $mqr=0; }
|
||||
if ($mqr) { set_magic_quotes_runtime(0); }
|
||||
|
||||
$l = file('mpdf_source.php');
|
||||
if (!count($l)) { die("ERROR - Could not find mpdf_source.php file in current directory"); }
|
||||
$exclflags = array();
|
||||
$x = '';
|
||||
|
||||
// Excluding 'HTML-CSS' will also exclude: 'TABLES', 'LISTS', 'TABLES-ADVANCED-BORDERS', 'HTMLHEADERS-FOOTERS', 'FORMS', 'BACKGROUNDS', 'CSS-FLOAT', 'CSS-IMAGE-FLOAT', 'CSS-POSITION', 'CSS-PAGE', 'BORDER-RADIUS'
|
||||
if ($excl[0]=='HTML-CSS') {
|
||||
$excl[] = 'TABLES';
|
||||
$excl[] = 'LISTS';
|
||||
$excl[] = 'TABLES-ADVANCED-BORDERS';
|
||||
$excl[] = 'HTMLHEADERS-FOOTERS';
|
||||
$excl[] = 'FORMS';
|
||||
$excl[] = 'BACKGROUNDS';
|
||||
$excl[] = 'CSS-FLOAT';
|
||||
$excl[] = 'CSS-IMAGE-FLOAT';
|
||||
$excl[] = 'CSS-POSITION';
|
||||
$excl[] = 'CSS-PAGE';
|
||||
$excl[] = 'BORDER-RADIUS';
|
||||
}
|
||||
$excl = array_unique($excl);
|
||||
|
||||
foreach($l AS $k=>$ln) {
|
||||
$exclude = false;
|
||||
// *XXXXX*
|
||||
preg_match_all("/\/\/ \*([A-Za-z\-]+)\*/", $ln, $m);
|
||||
foreach($m[1] AS $mm) {
|
||||
if (in_array($mm, $excl)) {
|
||||
$exclude = true;
|
||||
}
|
||||
}
|
||||
/*-- XXXXX --*/
|
||||
preg_match_all("/\/\*-- ([A-Za-z\-]+) --\*\//", $ln, $m);
|
||||
foreach($m[1] AS $mm) {
|
||||
if (in_array($mm, $excl)) {
|
||||
$exclflags[$mm] = true;
|
||||
}
|
||||
$exclude = true;
|
||||
}
|
||||
$exclflags = array_unique($exclflags);
|
||||
/*-- END XXXX --*/
|
||||
preg_match_all("/\/\*-- END ([A-Za-z\-]+) --\*\//", $ln, $m);
|
||||
foreach($m[1] AS $mm) {
|
||||
if (in_array($mm, $excl)) {
|
||||
unset($exclflags[$mm]);
|
||||
}
|
||||
$exclude = true;
|
||||
}
|
||||
if (count($exclflags)==0 && !$exclude) {
|
||||
$x .= $ln;
|
||||
}
|
||||
}
|
||||
// mPDF 5.0
|
||||
if (function_exists('file_put_contents')) {
|
||||
$check = file_put_contents('mpdf.php', $x);
|
||||
}
|
||||
else {
|
||||
$f=fopen('mpdf.php', 'w');
|
||||
$check = fwrite($f, $x);
|
||||
fclose($f);
|
||||
}
|
||||
if (!$check) { die("ERROR - Could not write to mpdf.php file. Are permissions correctly set?"); }
|
||||
echo '<p><b>mPDF file generated successfully!</b></p>';
|
||||
echo '<div>mPDF file size '.number_format((strlen($x)/1024)).' kB</div>';
|
||||
|
||||
unset($l);
|
||||
unset($x);
|
||||
|
||||
include('mpdf.php');
|
||||
$mpdf = new mPDF();
|
||||
|
||||
echo '<div>Memory usage on loading mPDF class '.number_format((memory_get_usage(true)/(1024*1024)),2).' MB</div>';
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
572
config.php
Normal file
572
config.php
Normal file
@ -0,0 +1,572 @@
|
||||
<?php
|
||||
|
||||
// mPDF 5.7
|
||||
// Specify whether to automatically generate bookmarks or ToC entries from h1 - h6 tags
|
||||
$this->h2bookmarks = array();
|
||||
$this->h2toc = array();
|
||||
/* Define arrays with e.g. the tag=>ToC-level
|
||||
Remember bookmark and ToC levels start at 0
|
||||
(does not work inside tables)
|
||||
Only the default ToC will be used if > 1 ToCs are defined for the document
|
||||
H1 - H6 must be uppercase
|
||||
$this->h2toc = array('H1'=>0, 'H2'=>1, 'H3'=>2);
|
||||
$this->h2bookmarks = array('H1'=>0, 'H2'=>1, 'H3'=>2);
|
||||
*/
|
||||
|
||||
// mPDF 5.7
|
||||
// Text-align on decimal marks
|
||||
// Allowed characters for alignment on decimal marks. Additional codes must start with D
|
||||
// Non-ASCII characters should be in utf-8 encoding
|
||||
// DM - middot U+00B7
|
||||
// DA - arabic decimal mark U+066B
|
||||
$this->decimal_align = array('DP'=>'.', 'DC'=>',', 'DM'=>"\xc2\xb7", 'DA'=>"\xd9\xab", 'DD'=>'-');
|
||||
|
||||
// PAGING
|
||||
$this->mirrorMargins = 0;
|
||||
$this->restoreBlockPagebreaks = false;
|
||||
$this->forcePortraitMargins = false;
|
||||
$this->displayDefaultOrientation = false;
|
||||
$this->printers_info = false; // Adds date and page info for printer when using @page and "marks:crop;"
|
||||
$this->bleedMargin = 5;
|
||||
$this->crossMarkMargin = 5; // Distance of cross mark from margin in mm
|
||||
$this->cropMarkMargin = 8; // Distance of crop mark from margin in mm
|
||||
$this->cropMarkLength = 18; // Default length in mm of crop line
|
||||
$this->nonPrintMargin = 8; // Non-printable border at edge of paper sheet in mm
|
||||
// mPDF 5.5
|
||||
// Avoid just the border/background-color of the end of a block being moved on to next page
|
||||
$this->margBuffer = 2; // Allows an (empty) end of block to extend beyond the bottom margin by this amount (mm)
|
||||
|
||||
|
||||
// PAGE NUMBERING
|
||||
$this->pagenumPrefix;
|
||||
$this->pagenumSuffix;
|
||||
$this->nbpgPrefix;
|
||||
$this->nbpgSuffix;
|
||||
|
||||
|
||||
// FONTS, LANGUAGES & CHARACTER SETS
|
||||
// Set maximum size of TTF font file to allow non-subsets - in kB
|
||||
// Used to avoid e.g. Arial Unicode MS (perhaps used for substitutions) to ever be fully embedded
|
||||
// NB Free serif is 1.5MB, most files are <= 600kB (most 200-400KB)
|
||||
$this->maxTTFFilesize = 2000;
|
||||
|
||||
// this value determines whether to subset or not
|
||||
// 0 - 100 = percent characters
|
||||
// i.e. if ==40, mPDF will embed whole font if >40% characters in that font
|
||||
// or embed subset if <40% characters
|
||||
// 0 will force whole file to be embedded (NO subsetting)
|
||||
// 100 will force always to subset
|
||||
// This value is overridden if you set new mPDF('s)
|
||||
// and/or Can set at runtime
|
||||
$this->percentSubset = 30;
|
||||
|
||||
$this->useAdobeCJK = false; // Uses Adobe CJK fonts for CJK languages
|
||||
// default TRUE; only set false if you have defined some available fonts that support CJK
|
||||
// If true this will not stop use of other CJK fonts if specified by font-family:
|
||||
// and vice versa i.e. only dictates behaviour when specified by lang="" incl. AutoFont()
|
||||
|
||||
// When embedding full TTF font files, remakes the font file using only core tables
|
||||
// May improve function with some PostScript printers (GhostScript/GSView)
|
||||
// Does not work with TTC font collections
|
||||
// Slightly smaller file; increased processing time
|
||||
$this->repackageTTF = false;
|
||||
|
||||
// Allows automatic character set conversion if "charset=xxx" detected in html header (WriteHTML() )
|
||||
$this->allow_charset_conversion = true;
|
||||
$this->biDirectional=false; // automatically determine BIDI text in LTR page
|
||||
$this->autoFontGroupSize = 2; // 1: individual words are spanned; 2: words+; 3: as big chunks as possible.
|
||||
$this->useLang = true; // Default changed in mPDF 4.0
|
||||
|
||||
$this->useSubstitutions = false; // Substitute missing characters in UTF-8(multibyte) documents - from other fonts
|
||||
$this->falseBoldWeight = 5; // Weight for bold text when using an artificial (outline) bold; value 0 (off) - 10 (rec. max)
|
||||
|
||||
// CONFIGURATION
|
||||
$this->allow_output_buffering = false;
|
||||
|
||||
$this->enableImports = false; // Adding mPDFI functions
|
||||
|
||||
$this->collapseBlockMargins = true; // Allows top and bottom margins to collapse between block elements
|
||||
$this->progressBar = 0; // Shows progress-bars whilst generating file 0 off, 1 simple, 2 advanced
|
||||
$this->progbar_heading = 'mPDF file progress';
|
||||
$this->progbar_altHTML = ''; // Should include <html> and <body> but NOT end tags
|
||||
// Can incude <head> and link to stylesheet etc.
|
||||
// e.g. '<html><body><p><img src="loading.gif" /> Creating PDF file. Please wait...</p>';
|
||||
|
||||
$this->dpi = 96; // To interpret "px" pixel values in HTML/CSS (see img_dpi below)
|
||||
|
||||
// Automatically correct for tags where HTML specifies optional end tags e.g. P,LI,DD,TD
|
||||
// If you are confident input html is valid XHTML, turning this off may make it more reliable(?)
|
||||
$this->allow_html_optional_endtags = true;
|
||||
|
||||
$this->ignore_invalid_utf8 = false;
|
||||
$this->text_input_as_HTML = false; // Converts all entities in Text inputs to UTF-8 before encoding
|
||||
$this->useGraphs = false;
|
||||
|
||||
|
||||
// When writing a block element with position:fixed and overflow:auto, mPDF scales it down to fit in the space
|
||||
// by repeatedly rewriting it and making adjustments. These values give the adjustments used, depending how far out
|
||||
// the previous guess was. The lower the number, the quicker it will finish, but the less accurate the fit may be.
|
||||
// FPR1 is for coarse adjustments, and FPR4 for fine adjustments when it is getting closer.
|
||||
$this->incrementFPR1 = 10; // i.e. will alter by 1/[10]th of width and try again until within closer limits
|
||||
$this->incrementFPR2 = 20;
|
||||
$this->incrementFPR3 = 30;
|
||||
$this->incrementFPR4 = 50; // i.e. will alter by 1/[50]th of width and try again when it nearly fits
|
||||
|
||||
|
||||
// COLORSPACE
|
||||
// 1 - allow GRAYSCALE only [convert CMYK/RGB->gray]
|
||||
// 2 - allow RGB / SPOT COLOR / Grayscale [convert CMYK->RGB]
|
||||
// 3 - allow CMYK / SPOT COLOR / Grayscale [convert RGB->CMYK]
|
||||
$this->restrictColorSpace = 0;
|
||||
|
||||
// PDFX/1-a Compliant files
|
||||
$this->PDFX = false; // true=Forces compliance with PDFX-1a spec
|
||||
// Cannot be used with $this->restrictColorSpace (i.e. no RGB)
|
||||
$this->PDFXauto = false; // Overrides warnings making changes when possible to force PDFX1-a compliance
|
||||
|
||||
|
||||
// PDFA1-b Compliant files
|
||||
$this->PDFA = false; // true=Forces compliance with PDFA-1b spec
|
||||
// Can use with $this->restrictColorSpace=3 (for a CMYK file)
|
||||
// Any other settings, uses RGB profile
|
||||
$this->PDFAauto = false; // Overrides warnings making changes when possible to force PDFA1-b compliance
|
||||
$this->ICCProfile = ''; // Colour profile OutputIntent
|
||||
// sRGB_IEC61966-2-1 (=default if blank and PDFA), or other added .icc profile
|
||||
// Must be CMYK for PDFX, or appropriate type for PDFA(RGB or CMYK)
|
||||
|
||||
|
||||
|
||||
// DEBUGGING & DEVELOPERS
|
||||
$this->showStats = false;
|
||||
$this->debug = false;
|
||||
$this->debugfonts = false; // Checks and reports on errors when parsing TTF files - adds significantly to processing time
|
||||
$this->showImageErrors = false;
|
||||
$this->table_error_report = false; // Die and report error if table is too wide to contain whole words
|
||||
$this->table_error_report_param = ''; // Parameter which can be passed to show in error report i.e. chapter number being processed//
|
||||
|
||||
|
||||
// ANNOTATIONS
|
||||
$this->title2annots = false;
|
||||
$this->annotSize = 0.5; // default mm for Adobe annotations - nominal
|
||||
$this->annotMargin; // default position for Annotations
|
||||
$this->annotOpacity = 0.5; // default opacity for Annotations
|
||||
|
||||
// BOOKMARKS
|
||||
$this->anchor2Bookmark = 0; // makes <a name=""> into a bookmark as well as internal link target; 1 = just name; 2 = name (p.34)
|
||||
// Set an optional array to specify appearance of Bookmarks (by level)
|
||||
// Default values are Black and normal style
|
||||
/*
|
||||
Example:
|
||||
$this->bookmarkStyles = array(
|
||||
0 => array('color'=> array(0,64,128), 'style'=>'B'),
|
||||
1 => array('color'=> array(128,0,0), 'style'=>''),
|
||||
2 => array('color'=> array(0,128,0), 'style'=>'I'),
|
||||
);
|
||||
*/
|
||||
$this->bookmarkStyles = array();
|
||||
|
||||
|
||||
// CSS & STYLES
|
||||
$this->CSSselectMedia='print'; // screen, print, or any other CSS @media type (not "all")
|
||||
|
||||
|
||||
// PAGE HEADERS & FOOTERS
|
||||
$this->forcePortraitHeaders = false;
|
||||
// Values used if simple FOOTER/HEADER given i.e. not array
|
||||
$this->defaultheaderfontsize = 8; // pt
|
||||
$this->defaultheaderfontstyle = 'BI'; // '', or 'B' or 'I' or 'BI'
|
||||
$this->defaultheaderline = 1; // 1 or 0 - line under the header
|
||||
$this->defaultfooterfontsize = 8; // pt
|
||||
$this->defaultfooterfontstyle = 'BI'; // '', or 'B' or 'I' or 'BI'
|
||||
$this->defaultfooterline = 1; // 1 or 0 - line over the footer
|
||||
$this->header_line_spacing = 0.25; // spacing between bottom of header and line (if present) - function of fontsize
|
||||
$this->footer_line_spacing = 0.25; // spacing between bottom of header and line (if present) - function of fontsize
|
||||
// If 'pad' margin-top sets fixed distance in mm (padding) between bottom of header and top of text.
|
||||
// If 'stretch' margin-top sets a minimum distance in mm between top of page and top of text, which expands if header is too large to fit.
|
||||
$this->setAutoTopMargin = false;
|
||||
$this->setAutoBottomMargin = false;
|
||||
$this->autoMarginPadding = 2; // distance in mm used as padding if 'stretch' mode is used
|
||||
|
||||
|
||||
|
||||
// TABLES
|
||||
$this->simpleTables = false; // Forces all cells to have same border, background etc. Improves performance
|
||||
$this->packTableData = false; // Reduce memory usage processing tables (but with increased processing time)
|
||||
// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased
|
||||
// executon time and disk access (read and write)
|
||||
$this->cacheTables = false;
|
||||
|
||||
$this->ignore_table_percents = false;
|
||||
$this->ignore_table_widths = false;
|
||||
$this->keep_table_proportions = false; // If table width set > page width, force resizing but keep relative sizes
|
||||
// Also forces respect of cell widths set by %
|
||||
$this->shrink_tables_to_fit = 1.4; // automatically reduce fontsize in table if words would have to split ( not in CJK)
|
||||
// 0 or false to disable; value (if set) gives maximum factor to reduce fontsize
|
||||
|
||||
$this->tableMinSizePriority = false; // If page-break-inside:avoid but cannot fit on full page without
|
||||
// exceeding autosize; setting this value to true will force respsect for
|
||||
// autosize, and disable the page-break-inside:avoid
|
||||
|
||||
$this->use_kwt = false; // "Keep-with-table"
|
||||
$this->iterationCounter = false; // Set to TRUE to use table Head iteration counter
|
||||
$this->splitTableBorderWidth = 0; // Use table border (using this width in mm) when table breaks across pages
|
||||
// Recommended to use small value e.g. 0.01
|
||||
|
||||
|
||||
// IMAGES
|
||||
$this->img_dpi = 96; // Default dpi to output images if size not defined
|
||||
// See also above "dpi"
|
||||
|
||||
// TEXT SPACING & JUSTIFICATION
|
||||
$this->useKerning = false; // true to use kerning
|
||||
$this->justifyB4br = false; // In justified text, <BR> does not cause the preceding text to be justified in browsers
|
||||
// Change to true to force justification (as in MS Word)
|
||||
|
||||
$this->tabSpaces = 8; // Number of spaces to replace for a TAB in <pre> sections
|
||||
// Notepad uses 6, HTML specification recommends 8
|
||||
$this->jSWord = 0.4; // Proportion (/1) of space (when justifying margins) to allocate to Word vs. Character
|
||||
$this->jSmaxChar = 2; // Maximum spacing to allocate to character spacing. (0 = no maximum)
|
||||
|
||||
$this->jSmaxCharLast = 1; // Maximum character spacing allowed (carried over) when finishing a last line
|
||||
$this->jSmaxWordLast = 2; // Maximum word spacing allowed (carried over) when finishing a last line
|
||||
$this->normalLineheight = 1.33; // Value used for line-height when CSS specified as 'normal' (default)
|
||||
|
||||
// Small Caps
|
||||
$this->smCapsScale = 0.75; // Factor of 1 to scale capital letters
|
||||
$this->smCapsStretch = 110; // % to stretch small caps horizontally (i.e. 100 = no stretch)
|
||||
|
||||
// CJK Line-breaking
|
||||
$this->allowCJKorphans = true; // FALSE=always wrap to next line; TRUE=squeeze or overflow
|
||||
$this->allowCJKoverflow = false; // FALSE=squeeze; TRUE=overflow (only some characters, and disabled in tables)
|
||||
$this->CJKforceend = false; // Forces overflowng punctuation to hang outside right margin mPDF 5.6.40
|
||||
|
||||
// HYPHENATION
|
||||
$this->SHYlang = "en"; // Should be one of: 'en','de','es','fi','fr','it','nl','pl','ru','sv'
|
||||
$this->SHYleftmin = 2;
|
||||
$this->SHYrightmin = 2;
|
||||
$this->SHYcharmin = 2;
|
||||
$this->SHYcharmax = 10;
|
||||
|
||||
// COLUMNS
|
||||
$this->keepColumns = false; // Set to go to the second column only when the first is full of text etc.
|
||||
$this->max_colH_correction = 1.15; // Maximum ratio to adjust column height when justifying - too large a value can give ugly results
|
||||
$this->ColGap=5;
|
||||
|
||||
|
||||
// LISTS
|
||||
$this->list_align_style = 'R'; // Determines alignment of numbers in numbered lists
|
||||
$this->list_indent_first_level = 0; // 1/0 yex/no to indent first level of list
|
||||
$this->list_number_suffix = '.'; // Content to follow a numbered list marker e.g. '.' gives 1. or IV.; ')' gives 1) or a)
|
||||
|
||||
// ACTIVE FORMS
|
||||
$this->useActiveForms = false;
|
||||
|
||||
// WATERMARKS
|
||||
$this->watermarkImgBehind = false;
|
||||
$this->showWatermarkText = 0;
|
||||
$this->showWatermarkImage = 0;
|
||||
$this->watermarkText = '';
|
||||
$this->watermarkImage = '';
|
||||
$this->watermark_font = '';
|
||||
$this->watermarkTextAlpha = 0.2;
|
||||
$this->watermarkImageAlpha = 0.2;
|
||||
$this->watermarkImgAlphaBlend = 'Normal';
|
||||
// Accepts any PDF spec. value: Normal, Multiply, Screen, Overlay, Darken, Lighten, ColorDodge, ColorBurn,
|
||||
// HardLight, SoftLight, Difference, Exclusion
|
||||
// "Multiply" works well for watermark image on top
|
||||
|
||||
// BORDERS
|
||||
$this->autoPadding = false; // Automatically increases padding in block elements when border-radius set - if required
|
||||
|
||||
|
||||
//////////////////////////////////////////////
|
||||
|
||||
// Default values if no style sheet offered (cf. http://www.w3.org/TR/CSS21/sample.html)
|
||||
$this->defaultCSS = array(
|
||||
'BODY' => array(
|
||||
'FONT-FAMILY' => 'serif',
|
||||
'FONT-SIZE' => '11pt',
|
||||
'TEXT-INDENT' => '0pt',
|
||||
'LINE-HEIGHT' => 'normal',
|
||||
'MARGIN-COLLAPSE' => 'collapse', /* Custom property to collapse top/bottom margins at top/bottom of page - ignored in tables/lists */
|
||||
'HYPHENS' => 'manual', /* mPDF 5.6.08 */
|
||||
),
|
||||
'P' => array(
|
||||
'MARGIN' => '1.12em 0',
|
||||
),
|
||||
'H1' => array(
|
||||
'FONT-SIZE' => '2em',
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'MARGIN' => '0.67em 0',
|
||||
'PAGE-BREAK-AFTER' => 'avoid',
|
||||
),
|
||||
'H2' => array(
|
||||
'FONT-SIZE' => '1.5em',
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'MARGIN' => '0.75em 0',
|
||||
'PAGE-BREAK-AFTER' => 'avoid',
|
||||
),
|
||||
'H3' => array(
|
||||
'FONT-SIZE' => '1.17em',
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'MARGIN' => '0.83em 0',
|
||||
'PAGE-BREAK-AFTER' => 'avoid',
|
||||
),
|
||||
'H4' => array(
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'MARGIN' => '1.12em 0',
|
||||
'PAGE-BREAK-AFTER' => 'avoid',
|
||||
),
|
||||
'H5' => array(
|
||||
'FONT-SIZE' => '0.83em',
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'MARGIN' => '1.5em 0',
|
||||
'PAGE-BREAK-AFTER' => 'avoid',
|
||||
),
|
||||
'H6' => array(
|
||||
'FONT-SIZE' => '0.75em',
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'MARGIN' => '1.67em 0',
|
||||
'PAGE-BREAK-AFTER' => 'avoid',
|
||||
),
|
||||
'HR' => array(
|
||||
'COLOR' => '#888888',
|
||||
'TEXT-ALIGN' => 'center',
|
||||
'WIDTH' => '100%',
|
||||
'HEIGHT' => '0.2mm',
|
||||
'MARGIN-TOP' => '0.83em',
|
||||
'MARGIN-BOTTOM' => '0.83em',
|
||||
),
|
||||
'PRE' => array(
|
||||
'MARGIN' => '0.83em 0',
|
||||
'FONT-FAMILY' => 'monospace',
|
||||
),
|
||||
'S' => array(
|
||||
'TEXT-DECORATION' => 'line-through',
|
||||
),
|
||||
'STRIKE' => array(
|
||||
'TEXT-DECORATION' => 'line-through',
|
||||
),
|
||||
'DEL' => array(
|
||||
'TEXT-DECORATION' => 'line-through',
|
||||
),
|
||||
'SUB' => array(
|
||||
'VERTICAL-ALIGN' => 'sub',
|
||||
'FONT-SIZE' => '55%', /* Recommended 0.83em */
|
||||
),
|
||||
'SUP' => array(
|
||||
'VERTICAL-ALIGN' => 'super',
|
||||
'FONT-SIZE' => '55%', /* Recommended 0.83em */
|
||||
),
|
||||
'U' => array(
|
||||
'TEXT-DECORATION' => 'underline',
|
||||
),
|
||||
'INS' => array(
|
||||
'TEXT-DECORATION' => 'underline',
|
||||
),
|
||||
'B' => array(
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
),
|
||||
'STRONG' => array(
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
),
|
||||
'I' => array(
|
||||
'FONT-STYLE' => 'italic',
|
||||
),
|
||||
'CITE' => array(
|
||||
'FONT-STYLE' => 'italic',
|
||||
),
|
||||
'Q' => array(
|
||||
'FONT-STYLE' => 'italic',
|
||||
),
|
||||
'EM' => array(
|
||||
'FONT-STYLE' => 'italic',
|
||||
),
|
||||
'VAR' => array(
|
||||
'FONT-STYLE' => 'italic',
|
||||
),
|
||||
'SAMP' => array(
|
||||
'FONT-FAMILY' => 'monospace',
|
||||
),
|
||||
'CODE' => array(
|
||||
'FONT-FAMILY' => 'monospace',
|
||||
),
|
||||
'KBD' => array(
|
||||
'FONT-FAMILY' => 'monospace',
|
||||
),
|
||||
'TT' => array(
|
||||
'FONT-FAMILY' => 'monospace',
|
||||
),
|
||||
'SMALL' => array(
|
||||
'FONT-SIZE' => '83%',
|
||||
),
|
||||
'BIG' => array(
|
||||
'FONT-SIZE' => '117%',
|
||||
),
|
||||
'ACRONYM' => array(
|
||||
'FONT-SIZE' => '77%',
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
),
|
||||
'ADDRESS' => array(
|
||||
'FONT-STYLE' => 'italic',
|
||||
),
|
||||
'BLOCKQUOTE' => array(
|
||||
'MARGIN-LEFT' => '40px',
|
||||
'MARGIN-RIGHT' => '40px',
|
||||
'MARGIN-TOP' => '1.12em',
|
||||
'MARGIN-BOTTOM' => '1.12em',
|
||||
),
|
||||
'A' => array(
|
||||
'COLOR' => '#0000FF',
|
||||
'TEXT-DECORATION' => 'underline',
|
||||
),
|
||||
'UL' => array(
|
||||
'MARGIN' => '0.83em 0', /* only applied to top-level of nested lists */
|
||||
'TEXT-INDENT' => '1.3em', /* Custom effect - list indent */
|
||||
),
|
||||
'OL' => array(
|
||||
'MARGIN' => '0.83em 0', /* only applied to top-level of nested lists */
|
||||
'TEXT-INDENT' => '1.3em', /* Custom effect - list indent */
|
||||
),
|
||||
'DL' => array(
|
||||
'MARGIN' => '1.67em 0',
|
||||
),
|
||||
'DT' => array(
|
||||
),
|
||||
'DD' => array(
|
||||
'PADDING-LEFT' => '40px',
|
||||
),
|
||||
'TABLE' => array(
|
||||
'MARGIN' => '0',
|
||||
'BORDER-COLLAPSE' => 'separate',
|
||||
'BORDER-SPACING' => '2px',
|
||||
'EMPTY-CELLS' => 'show',
|
||||
'LINE-HEIGHT' => '1.2',
|
||||
'VERTICAL-ALIGN' => 'middle',
|
||||
),
|
||||
'THEAD' => array(
|
||||
),
|
||||
'TFOOT' => array(
|
||||
),
|
||||
'TH' => array(
|
||||
'FONT-WEIGHT' => 'bold',
|
||||
'TEXT-ALIGN' => 'center',
|
||||
'PADDING-LEFT' => '0.1em',
|
||||
'PADDING-RIGHT' => '0.1em',
|
||||
'PADDING-TOP' => '0.1em',
|
||||
'PADDING-BOTTOM' => '0.1em',
|
||||
),
|
||||
'TD' => array(
|
||||
'PADDING-LEFT' => '0.1em',
|
||||
'PADDING-RIGHT' => '0.1em',
|
||||
'PADDING-TOP' => '0.1em',
|
||||
'PADDING-BOTTOM' => '0.1em',
|
||||
),
|
||||
'CAPTION' => array(
|
||||
'TEXT-ALIGN' => 'center',
|
||||
),
|
||||
'IMG' => array(
|
||||
'MARGIN' => '0',
|
||||
'VERTICAL-ALIGN' => 'baseline',
|
||||
),
|
||||
'INPUT' => array(
|
||||
'FONT-FAMILY' => 'sans-serif',
|
||||
'VERTICAL-ALIGN' => 'middle',
|
||||
'FONT-SIZE' => '0.9em',
|
||||
),
|
||||
'SELECT' => array(
|
||||
'FONT-FAMILY' => 'sans-serif',
|
||||
'FONT-SIZE' => '0.9em',
|
||||
'VERTICAL-ALIGN' => 'middle',
|
||||
),
|
||||
'TEXTAREA' => array(
|
||||
'FONT-FAMILY' => 'monospace',
|
||||
'FONT-SIZE' => '0.9em',
|
||||
'VERTICAL-ALIGN' => 'text-bottom',
|
||||
),
|
||||
'MARK' => array( /* mPDF 5.5.09 */
|
||||
'BACKGROUND-COLOR' => 'yellow',
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
// VALUES ONLY LIKELY TO BE CHANGED BY DEVELOPERS
|
||||
//////////////////////////////////////////////////
|
||||
$this->pdf_version = '1.4';
|
||||
|
||||
// Hyphenation
|
||||
$this->SHYlanguages = array('en','de','es','fi','fr','it','nl','pl','ru','sv'); // existing defined patterns
|
||||
|
||||
$this->default_lineheight_correction=1.2; // Value 1 sets lineheight=fontsize height;
|
||||
// Value used if line-height not set by CSS (usuallly is)
|
||||
|
||||
$this->fontsizes = array('XX-SMALL'=>0.7, 'X-SMALL'=>0.77, 'SMALL'=>0.86, 'MEDIUM'=>1, 'LARGE'=>1.2, 'X-LARGE'=>1.5, 'XX-LARGE'=>2);
|
||||
|
||||
// CHARACTER PATTERN MATCHES TO DETECT LANGUAGES
|
||||
// pattern used to detect RTL characters -> force RTL
|
||||
$this->pregRTLchars = "\x{0590}-\x{06FF}\x{0700}-\x{083E}\x{FB00}-\x{FDFD}\x{FE70}-\x{FEFF}";
|
||||
|
||||
// CJK Chars which require changing and are distinctive of specific charset
|
||||
$this->pregUHCchars = "\x{1100}-\x{11FF}\x{3130}-\x{318F}\x{AC00}-\x{D7AF}";
|
||||
$this->pregSJISchars = "\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3190}-\x{319F}\x{31F0}-\x{31FF}";
|
||||
|
||||
// Chars which distinguish CJK but not between different
|
||||
$this->pregCJKchars = "\x{1100}-\x{11FF}\x{2E80}-\x{A4CF}\x{A800}-\x{D7AF}\x{F900}-\x{FAFF}\x{FE30}-\x{FE6F}\x{FF00}-\x{FFEF}\x{20000}-\x{2FA1F}";
|
||||
|
||||
// For CJK Line-breaking
|
||||
//Leading characters - Not allowed at end of line
|
||||
$this->CJKleading = "\$\(\*\[\{\x{00a3}\x{00a5}\x{00ab}\x{00b7}\x{2018}\x{201c}\x{2035}\x{3005}\x{3007}\x{3008}\x{300a}\x{300c}\x{300e}\x{3010}\x{3014}\x{3016}\x{3018}\x{301d}\x{fe34}\x{fe57}\x{fe59}\x{fe5b}\x{ff04}\x{ff08}\x{ff0e}\x{ff3b}\x{ff5b}\x{ff5f}\x{ffe1}\x{ffe5}\x{ffe6}";
|
||||
// Following characters - Not allowed at start
|
||||
$this->CJKfollowing = "!%\),\.:;>\?\]\}\x{00a2}\x{00a8}\x{00b0}\x{00b7}\x{00bb}\x{02c7}\x{02c9}\x{2010}\x{2013}-\x{2016}\x{2019}\x{201d}-\x{201f}\x{2020}-\x{2022}\x{2025}\x{2027}\x{203a}\x{203c}\x{2047}-\x{2049}\x{2103}\x{2236}\x{2574}\x{3001}-\x{3003}\x{3005}\x{3006}\x{3009}\x{300b}\x{300d}\x{300f}\x{3011}\x{3015}\x{3017}\x{3019}\x{301c}\x{301e}\x{301f}\x{303b}\x{3041}\x{3043}\x{3045}\x{3047}\x{3049}\x{3063}\x{3083}\x{3085}\x{3087}\x{308e}\x{3095}\x{3096}\x{30a0}\x{30a1}\x{30a3}\x{30a5}\x{30a7}\x{30a9}\x{30c3}\x{30e3}\x{30e5}\x{30e7}\x{30ee}\x{30f5}\x{30f6}\x{30fb}-\x{30fe}\x{31f0}-\x{31ff}\x{fe30}-\x{fe33}\x{fe50}-\x{fe56}\x{fe58}\x{fe5a}\x{fe5c}\x{ff01}\x{ff02}\x{ff05}\x{ff07}\x{ff09}\x{ff0c}\x{ff0e}\x{ff1a}\x{ff1b}\x{ff1f}\x{ff3d}\x{ff40}\x{ff5c}-\x{ff5e}\x{ff60}\x{ff64}";
|
||||
// Characters which are allowed to overflow the right margin
|
||||
$this->CJKoverflow = "\.,\x{ff61}\x{ff64}\x{3001}\x{3002}\x{ff0c}\x{ff0e}";
|
||||
|
||||
|
||||
|
||||
// ASCII Chars which shouldn't break string
|
||||
// Use for very specific words
|
||||
$this->pregASCIIchars1 = "\x{0021}-\x{002E}\x{0030}-\x{003B}?"; // no [SPACE]
|
||||
// Use for words+
|
||||
$this->pregASCIIchars2 = "\x{0020}-\x{002E}\x{0030}-\x{003B}?"; // [SPACE] punctuation and 0-9
|
||||
// Use for chunks > words
|
||||
$this->pregASCIIchars3 = "\x{0000}-\x{002E}\x{0030}-\x{003B}\x{003F}-\x{007E}"; // all except <>
|
||||
// Vietnamese - specific
|
||||
$this->pregVIETchars = "\x{01A0}\x{01A1}\x{01AF}\x{01B0}\x{1EA0}-\x{1EF1}";
|
||||
// Vietnamese - Chars which shouldn't break string
|
||||
$this->pregVIETPluschars = "\x{0000}-\x{003B}\x{003F}-\x{00FF}\x{0300}-\x{036F}\x{0102}\x{0103}\x{0110}\x{0111}\x{0128}\x{0129}\x{0168}\x{0169}\x{1EF1}-\x{1EF9}"; // omits < >
|
||||
|
||||
// Arabic
|
||||
$this->pregARABICchars = "\x{0600}-\x{06FF}\x{0750}-\x{077F}\x{FB50}-\x{FDFD}\x{FE70}-\x{FEFF}";
|
||||
// Characters of Urdu, Pashto, Sindhi (but NOT arabic or persian/farsi) [not covered by DejavuSans font]
|
||||
$this->pregNonARABICchars = "\x{0671}-\x{067D}\x{067F}-\x{0685}\x{0687}-\x{0697}\x{0699}-\x{06A8}\x{06AA}-\x{06AE}\x{06B0}-\x{06CB}\x{06CD}-\x{06D3}";
|
||||
|
||||
$this->pregHEBchars = "\x{0590}-\x{05FF}\x{FB00}-\x{FB49}"; // Hebrew
|
||||
|
||||
// INDIC
|
||||
$this->pregHIchars = "\x{0900}-\x{0963}\x{0966}-\x{097F}"; // Devanagari (Hindi) minus the common indic punctuation 0964,0965
|
||||
$this->pregBNchars = "\x{0980}-\x{09FF}"; // Bengali
|
||||
$this->pregPAchars = "\x{0A00}-\x{0A7F}"; // Gurmukhi (Punjabi)
|
||||
$this->pregGUchars = "\x{0A80}-\x{0AFF}"; // Gujarati
|
||||
$this->pregORchars = "\x{0B00}-\x{0B7F}"; // Oriya
|
||||
$this->pregTAchars = "\x{0B80}-\x{0BFF}"; // Tamil
|
||||
$this->pregTEchars = "\x{0C00}-\x{0C7F}"; // Telugu
|
||||
$this->pregKNchars = "\x{0C80}-\x{0CFF}"; // Kannada
|
||||
$this->pregMLchars = "\x{0D00}-\x{0D7F}"; // Malayalam
|
||||
$this->pregSHchars = "\x{0D80}-\x{0DFF}"; // Sinhala
|
||||
|
||||
$this->pregINDextra = "\x{200B}-\x{200D}\x{0964}\x{0965}\x{0020}-\x{0022}\x{0024}-\x{002E}\x{003A}-\x{003F}\x{005B}-\x{0060}\x{007B}-\x{007E}\x{00A0}";
|
||||
// 200B-D=Zero-width joiners; 0964,0965=Generic Indic punctuation; NBSP & general punctuation (excludes # and / so can use in autoFont() )
|
||||
|
||||
$this->allowedCSStags = 'DIV|P|H1|H2|H3|H4|H5|H6|FORM|IMG|A|BODY|TABLE|HR|THEAD|TFOOT|TBODY|TH|TR|TD|UL|OL|LI|PRE|BLOCKQUOTE|ADDRESS|DL|DT|DD';
|
||||
$this->allowedCSStags .= '|ARTICLE|ASIDE|FIGURE|FIGCAPTION|FOOTER|HEADER|HGROUP|NAV|SECTION|MARK|DETAILS|SUMMARY|METER|PROGRESS|TIME'; // mPDF 5.5.09
|
||||
$this->allowedCSStags .= '|SPAN|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|STRIKE|S|U|DEL|INS|Q|FONT';
|
||||
$this->allowedCSStags .= '|SELECT|INPUT|TEXTAREA|CAPTION|FIELDSET|LEGEND'; // mPDF 5.4.18
|
||||
$this->allowedCSStags .= '|TEXTCIRCLE|DOTTAB'; // mPDF 5.5.23 // mPDF 5.6.33
|
||||
|
||||
$this->outerblocktags = array('DIV','FORM','CENTER','DL','FIELDSET','ARTICLE','ASIDE','FIGURE','FIGCAPTION', 'FOOTER','HEADER','HGROUP','NAV','SECTION','DETAILS','SUMMARY'); // mPDF 5.5.09 // mPDF 5.5.22
|
||||
$this->innerblocktags = array('P','BLOCKQUOTE','ADDRESS','PRE','H1','H2','H3','H4','H5','H6','DT','DD','CAPTION');
|
||||
|
||||
|
||||
|
||||
?>
|
||||
153
config_cp.php
Normal file
153
config_cp.php
Normal file
@ -0,0 +1,153 @@
|
||||
<?php
|
||||
|
||||
|
||||
function GetLangOpts($llcc, $adobeCJK) {
|
||||
if (strlen($llcc) == 5) {
|
||||
$lang = substr(strtolower($llcc),0,2);
|
||||
$country = substr(strtoupper($llcc),3,2);
|
||||
}
|
||||
else { $lang = strtolower($llcc); $country = ''; }
|
||||
$unifonts = "";
|
||||
$coreSuitable = false;
|
||||
|
||||
switch($lang){
|
||||
CASE "en":
|
||||
CASE "ca":
|
||||
CASE "cy":
|
||||
CASE "da":
|
||||
CASE "de":
|
||||
CASE "es":
|
||||
CASE "eu":
|
||||
CASE "fr":
|
||||
CASE "ga":
|
||||
CASE "fi":
|
||||
CASE "is":
|
||||
CASE "it":
|
||||
CASE "nl":
|
||||
CASE "no":
|
||||
CASE "pt":
|
||||
CASE "sv":
|
||||
// Edit this value to define how mPDF behaves when using new mPDF('-x')
|
||||
// If set to TRUE, mPDF will use Adobe core fonts only when it recognises the languages above
|
||||
$coreSuitable = true; break;
|
||||
|
||||
|
||||
|
||||
// RTL Languages
|
||||
CASE "he":
|
||||
CASE "yi":
|
||||
$unifonts = "dejavusans,dejavusansB,dejavusansI,dejavusansBI"; break;
|
||||
|
||||
// Arabic
|
||||
CASE "ar":
|
||||
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
|
||||
CASE "fa":
|
||||
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
|
||||
CASE "ps":
|
||||
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
|
||||
CASE "ur":
|
||||
$unifonts = "xbriyaz,xbriyazB,xbriyazI,xbriyazBI,xbzar,xbzarB,xbzarI,xbzarBI"; break;
|
||||
|
||||
// Sindhi (can be Arabic or Devanagari)
|
||||
CASE "sd":
|
||||
if ($country == "IN") { $unifonts = "ind_hi_1_001"; }
|
||||
// else if ($country == "PK") { $unifonts = ""; }
|
||||
// else { $unifonts = ""; }
|
||||
break;
|
||||
|
||||
|
||||
// INDIC
|
||||
// Assamese
|
||||
CASE "as": $unifonts = "ind_bn_1_001"; break;
|
||||
// Bengali
|
||||
CASE "bn": $unifonts = "ind_bn_1_001"; break;
|
||||
// Gujarati
|
||||
CASE "gu": $unifonts = "ind_gu_1_001"; break;
|
||||
// Hindi (Devanagari)
|
||||
CASE "hi": $unifonts = "ind_hi_1_001"; break;
|
||||
// Kannada
|
||||
CASE "kn": $unifonts = "ind_kn_1_001"; break;
|
||||
// Kashmiri
|
||||
CASE "ks": $unifonts = "ind_hi_1_001"; break;
|
||||
// Malayalam
|
||||
CASE "ml": $unifonts = "ind_ml_1_001"; break;
|
||||
// Nepali (Devanagari)
|
||||
CASE "ne": $unifonts = "ind_hi_1_001"; break;
|
||||
// Oriya
|
||||
CASE "or": $unifonts = "ind_or_1_001"; break;
|
||||
// Punjabi (Gurmukhi)
|
||||
CASE "pa": $unifonts = "ind_pa_1_001"; break;
|
||||
// Tamil
|
||||
CASE "ta": $unifonts = "ind_ta_1_001"; break;
|
||||
// Telegu
|
||||
CASE "te": $unifonts = "ind_te_1_001"; break;
|
||||
|
||||
// THAI
|
||||
CASE "th": $unifonts = "garuda,garudaB,garudaI,garudaBI,norasi,norasiB,norasiI,norasiBI"; break;
|
||||
|
||||
// VIETNAMESE
|
||||
CASE "vi":
|
||||
$unifonts = "dejavusanscondensed,dejavusanscondensedB,dejavusanscondensedI,dejavusanscondensedBI,dejavusans,dejavusansB,dejavusansI,dejavusansBI"; break;
|
||||
|
||||
// CJK Langauges
|
||||
CASE "ja":
|
||||
if ($adobeCJK) {
|
||||
$unifonts = "sjis,sjisB,sjisI,sjisBI";
|
||||
}
|
||||
/* Uncomment these lines if CJK fonts available */
|
||||
// else {
|
||||
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
|
||||
// }
|
||||
break;
|
||||
|
||||
CASE "ko":
|
||||
if ($adobeCJK) {
|
||||
$unifonts = "uhc,uhcB,uhcI,uhcBI";
|
||||
}
|
||||
/* Uncomment these lines if CJK fonts available */
|
||||
// else {
|
||||
// $unifonts = "unbatang_0613";
|
||||
// }
|
||||
break;
|
||||
|
||||
CASE "zh":
|
||||
if ($country == "HK" || $country == "TW") {
|
||||
if ($adobeCJK) {
|
||||
$unifonts = "big5,big5B,big5I,big5BI";
|
||||
}
|
||||
/* Uncomment these lines if CJK fonts available */
|
||||
// else {
|
||||
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
|
||||
// }
|
||||
}
|
||||
else if ($country == "CN") {
|
||||
if ($adobeCJK) {
|
||||
$unifonts = "gb,gbB,gbI,gbBI";
|
||||
}
|
||||
/* Uncomment these lines if CJK fonts available */
|
||||
// else {
|
||||
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
|
||||
// }
|
||||
}
|
||||
else {
|
||||
if ($adobeCJK) {
|
||||
$unifonts = "gb,gbB,gbI,gbBI";
|
||||
}
|
||||
/* Uncomment these lines if CJK fonts available */
|
||||
// else {
|
||||
// $unifonts = "sun-exta,sun-extb,hannoma,hannomb";
|
||||
// }
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
$unifonts_arr = array();
|
||||
if ($unifonts) {
|
||||
$unifonts_arr = preg_split('/\s*,\s*/',$unifonts);
|
||||
}
|
||||
return array($coreSuitable ,$unifonts_arr);
|
||||
}
|
||||
|
||||
?>
|
||||
304
config_fonts.php
Normal file
304
config_fonts.php
Normal file
@ -0,0 +1,304 @@
|
||||
<?php
|
||||
|
||||
|
||||
// Optionally define a folder which contains TTF fonts
|
||||
// mPDF will look here before looking in the usual _MPDF_TTFONTPATH
|
||||
// Useful if you already have a folder for your fonts
|
||||
// e.g. on Windows: define("_MPDF_SYSTEM_TTFONTS", 'C:/Windows/Fonts/');
|
||||
// Leave undefined if not required
|
||||
|
||||
// define("_MPDF_SYSTEM_TTFONTS", '');
|
||||
|
||||
|
||||
// Optionally set font(s) (names as defined below in $this->fontdata) to use for missing characters
|
||||
// when using useSubstitutions. Use a font with wide coverage - dejavusanscondensed is a good start
|
||||
// only works using subsets (otherwise would add very large file)
|
||||
// doesn't do Indic or arabic
|
||||
// More than 1 font can be specified but each will add to the processing time of the script
|
||||
|
||||
$this->backupSubsFont = array('dejavusanscondensed');
|
||||
|
||||
|
||||
// Optionally set a font (name as defined below in $this->fontdata) to use for CJK characters
|
||||
// in Plane 2 Unicode (> U+20000) when using useSubstitutions.
|
||||
// Use a font like hannomb or sun-extb if available
|
||||
// only works using subsets (otherwise would add very large file)
|
||||
// Leave undefined or blank if not not required
|
||||
|
||||
// $this->backupSIPFont = 'sun-extb';
|
||||
|
||||
|
||||
/*
|
||||
This array defines translations from font-family in CSS or HTML
|
||||
to the internal font-family name used in mPDF.
|
||||
Can include as many as want, regardless of which fonts are installed.
|
||||
By default mPDF will take a CSS/HTML font-family and remove spaces
|
||||
and change to lowercase e.g. "Arial Unicode MS" will be recognised as
|
||||
"arialunicodems"
|
||||
You only need to define additional translations.
|
||||
You can also use it to define specific substitutions e.g.
|
||||
'frutiger55roman' => 'arial'
|
||||
Generic substitutions (i.e. to a sans-serif or serif font) are set
|
||||
by including the font-family in $this->sans_fonts below
|
||||
To aid backwards compatability some are included:
|
||||
*/
|
||||
$this->fonttrans = array(
|
||||
'helvetica' => 'arial',
|
||||
'times' => 'timesnewroman',
|
||||
'courier' => 'couriernew',
|
||||
'trebuchet' => 'trebuchetms',
|
||||
'comic' => 'comicsansms',
|
||||
'franklin' => 'franklingothicbook',
|
||||
'albertus' => 'albertusmedium',
|
||||
'arialuni' => 'arialunicodems',
|
||||
'zn_hannom_a' => 'hannoma',
|
||||
'ocr-b' => 'ocrb',
|
||||
'ocr-b10bt' => 'ocrb',
|
||||
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
This array lists the file names of the TrueType .ttf or .otf font files
|
||||
for each variant of the (internal mPDF) font-family name.
|
||||
['R'] = Regular (Normal), others are Bold, Italic, and Bold-Italic
|
||||
Each entry must contain an ['R'] entry, but others are optional.
|
||||
Only the font (files) entered here will be available to use in mPDF.
|
||||
Put preferred default first in order.
|
||||
This will be used if a named font cannot be found in any of
|
||||
$this->sans_fonts, $this->serif_fonts or $this->mono_fonts
|
||||
|
||||
['indic'] = true; for special mPDF fonts containing Indic characters
|
||||
['sip-ext'] = 'hannomb'; name a related font file containing SIP characters
|
||||
|
||||
If a .ttc TrueType collection file is referenced, the number of the font
|
||||
within the collection is required. Fonts in the collection are numbered
|
||||
starting at 1, as they appear in the .ttc file e.g.
|
||||
"cambria" => array(
|
||||
'R' => "cambria.ttc",
|
||||
'B' => "cambriab.ttf",
|
||||
'I' => "cambriai.ttf",
|
||||
'BI' => "cambriaz.ttf",
|
||||
'TTCfontID' => array(
|
||||
'R' => 1,
|
||||
),
|
||||
),
|
||||
"cambriamath" => array(
|
||||
'R' => "cambria.ttc",
|
||||
'TTCfontID' => array(
|
||||
'R' => 2,
|
||||
),
|
||||
),
|
||||
*/
|
||||
|
||||
$this->fontdata = array(
|
||||
"dejavusanscondensed" => array(
|
||||
'R' => "DejaVuSansCondensed.ttf",
|
||||
'B' => "DejaVuSansCondensed-Bold.ttf",
|
||||
'I' => "DejaVuSansCondensed-Oblique.ttf",
|
||||
'BI' => "DejaVuSansCondensed-BoldOblique.ttf",
|
||||
),
|
||||
"dejavusans" => array(
|
||||
'R' => "DejaVuSans.ttf",
|
||||
'B' => "DejaVuSans-Bold.ttf",
|
||||
'I' => "DejaVuSans-Oblique.ttf",
|
||||
'BI' => "DejaVuSans-BoldOblique.ttf",
|
||||
),
|
||||
"dejavuserif" => array(
|
||||
'R' => "DejaVuSerif.ttf",
|
||||
'B' => "DejaVuSerif-Bold.ttf",
|
||||
'I' => "DejaVuSerif-Italic.ttf",
|
||||
'BI' => "DejaVuSerif-BoldItalic.ttf",
|
||||
),
|
||||
"dejavuserifcondensed" => array(
|
||||
'R' => "DejaVuSerifCondensed.ttf",
|
||||
'B' => "DejaVuSerifCondensed-Bold.ttf",
|
||||
'I' => "DejaVuSerifCondensed-Italic.ttf",
|
||||
'BI' => "DejaVuSerifCondensed-BoldItalic.ttf",
|
||||
),
|
||||
"dejavusansmono" => array(
|
||||
'R' => "DejaVuSansMono.ttf",
|
||||
'B' => "DejaVuSansMono-Bold.ttf",
|
||||
'I' => "DejaVuSansMono-Oblique.ttf",
|
||||
'BI' => "DejaVuSansMono-BoldOblique.ttf",
|
||||
),
|
||||
|
||||
|
||||
/* OCR-B font for Barcodes */
|
||||
"ocrb" => array(
|
||||
'R' => "ocrb10.ttf",
|
||||
),
|
||||
|
||||
/* Thai fonts */
|
||||
"garuda" => array(
|
||||
'R' => "Garuda.ttf",
|
||||
'B' => "Garuda-Bold.ttf",
|
||||
'I' => "Garuda-Oblique.ttf",
|
||||
'BI' => "Garuda-BoldOblique.ttf",
|
||||
),
|
||||
"norasi" => array(
|
||||
'R' => "Norasi.ttf",
|
||||
'B' => "Norasi-Bold.ttf",
|
||||
'I' => "Norasi-Oblique.ttf",
|
||||
'BI' => "Norasi-BoldOblique.ttf",
|
||||
),
|
||||
|
||||
|
||||
/* Indic fonts */
|
||||
"ind_bn_1_001" => array(
|
||||
'R' => "ind_bn_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_hi_1_001" => array(
|
||||
'R' => "ind_hi_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_ml_1_001" => array(
|
||||
'R' => "ind_ml_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_kn_1_001" => array(
|
||||
'R' => "ind_kn_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_gu_1_001" => array(
|
||||
'R' => "ind_gu_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_or_1_001" => array(
|
||||
'R' => "ind_or_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_ta_1_001" => array(
|
||||
'R' => "ind_ta_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_te_1_001" => array(
|
||||
'R' => "ind_te_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
"ind_pa_1_001" => array(
|
||||
'R' => "ind_pa_1_001.ttf",
|
||||
'indic' => true,
|
||||
),
|
||||
|
||||
|
||||
/* XW Zar Arabic fonts */
|
||||
"xbriyaz" => array(
|
||||
'R' => "XB Riyaz.ttf",
|
||||
'B' => "XB RiyazBd.ttf",
|
||||
'I' => "XB RiyazIt.ttf",
|
||||
'BI' => "XB RiyazBdIt.ttf",
|
||||
'unAGlyphs' => true,
|
||||
),
|
||||
"xbzar" => array(
|
||||
'R' => "XB Zar.ttf",
|
||||
'B' => "XB Zar Bd.ttf",
|
||||
'I' => "XB Zar It.ttf",
|
||||
'BI' => "XB Zar BdIt.ttf",
|
||||
'unAGlyphs' => true,
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
/* Examples of some CJK fonts */
|
||||
/*
|
||||
"unbatang_0613" => array(
|
||||
'R' => "UnBatang_0613.ttf",
|
||||
),
|
||||
"sun-exta" => array(
|
||||
'R' => "Sun-ExtA.ttf",
|
||||
'sip-ext' => 'sun-extb',
|
||||
),
|
||||
"sun-extb" => array(
|
||||
'R' => "Sun-ExtB.ttf",
|
||||
),
|
||||
"hannoma" => array(
|
||||
'R' => "HAN NOM A.ttf",
|
||||
'sip-ext' => 'hannomb',
|
||||
),
|
||||
"hannomb" => array(
|
||||
'R' => "HAN NOM B.ttf",
|
||||
),
|
||||
|
||||
|
||||
'mingliu' => array (
|
||||
'R' => 'mingliu.ttc',
|
||||
'TTCfontID' => array (
|
||||
'R' => 1,
|
||||
),
|
||||
'sip-ext' => 'mingliu-extb',
|
||||
),
|
||||
'pmingliu' => array (
|
||||
'R' => 'mingliu.ttc',
|
||||
'TTCfontID' => array (
|
||||
'R' => 2,
|
||||
),
|
||||
'sip-ext' => 'pmingliu-extb',
|
||||
),
|
||||
'mingliu_hkscs' => array (
|
||||
'R' => 'mingliu.ttc',
|
||||
'TTCfontID' => array (
|
||||
'R' => 3,
|
||||
),
|
||||
'sip-ext' => 'mingliu_hkscs-extb',
|
||||
),
|
||||
'mingliu-extb' => array (
|
||||
'R' => 'mingliub.ttc',
|
||||
'TTCfontID' => array (
|
||||
'R' => 1,
|
||||
),
|
||||
),
|
||||
'pmingliu-extb' => array (
|
||||
'R' => 'mingliub.ttc',
|
||||
'TTCfontID' => array (
|
||||
'R' => 2,
|
||||
),
|
||||
),
|
||||
'mingliu_hkscs-extb' => array (
|
||||
'R' => 'mingliub.ttc',
|
||||
'TTCfontID' => array (
|
||||
'R' => 3,
|
||||
),
|
||||
),
|
||||
*/
|
||||
|
||||
);
|
||||
|
||||
|
||||
// Add fonts to this array if they contain characters in the SIP or SMP Unicode planes
|
||||
// but you do not require them. This allows a more efficient form of subsetting to be used.
|
||||
$this->BMPonly = array(
|
||||
"dejavusanscondensed",
|
||||
"dejavusans",
|
||||
"dejavuserifcondensed",
|
||||
"dejavuserif",
|
||||
"dejavusansmono",
|
||||
);
|
||||
|
||||
// These next 3 arrays do two things:
|
||||
// 1. If a font referred to in HTML/CSS is not available to mPDF, these arrays will determine whether
|
||||
// a serif/sans-serif or monospace font is substituted
|
||||
// 2. The first font in each array will be the font which is substituted in circumstances as above
|
||||
// (Otherwise the order is irrelevant)
|
||||
// Use the mPDF font-family names i.e. lowercase and no spaces (after any translations in $fonttrans)
|
||||
// Always include "sans-serif", "serif" and "monospace" etc.
|
||||
$this->sans_fonts = array('dejavusanscondensed','dejavusans','freesans','liberationsans','sans','sans-serif','cursive','fantasy',
|
||||
'arial','helvetica','verdana','geneva','lucida','arialnarrow','arialblack','arialunicodems',
|
||||
'franklin','franklingothicbook','tahoma','garuda','calibri','trebuchet','lucidagrande','microsoftsansserif',
|
||||
'trebuchetms','lucidasansunicode','franklingothicmedium','albertusmedium','xbriyaz','albasuper','quillscript'
|
||||
|
||||
);
|
||||
|
||||
$this->serif_fonts = array('dejavuserifcondensed','dejavuserif','freeserif','liberationserif','serif',
|
||||
'timesnewroman','times','centuryschoolbookl','palatinolinotype','centurygothic',
|
||||
'bookmanoldstyle','bookantiqua','cyberbit','cambria',
|
||||
'norasi','charis','palatino','constantia','georgia','albertus','xbzar','algerian','garamond',
|
||||
);
|
||||
|
||||
$this->mono_fonts = array('dejavusansmono','freemono','liberationmono','courier', 'mono','monospace','ocrb','ocr-b','lucidaconsole',
|
||||
'couriernew','monotypecorsiva'
|
||||
);
|
||||
|
||||
?>
|
||||
27
css/lightbox.css
Normal file
27
css/lightbox.css
Normal file
@ -0,0 +1,27 @@
|
||||
#lightbox{ position: absolute; left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
|
||||
#lightbox img{ width: auto; height: auto;}
|
||||
#lightbox a img{ border: none; }
|
||||
|
||||
#outerImageContainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; }
|
||||
#imageContainer{ padding: 10px; }
|
||||
|
||||
#loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
|
||||
#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
|
||||
#imageContainer>#hoverNav{ left: 0;}
|
||||
#hoverNav a{ outline: none;}
|
||||
|
||||
#prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
|
||||
#prevLink { left: 0; float: left;}
|
||||
#nextLink { right: 0; float: right;}
|
||||
#prevLink:hover, #prevLink:visited:hover { background: url(../images/prevlabel.gif) left 15% no-repeat; }
|
||||
#nextLink:hover, #nextLink:visited:hover { background: url(../images/nextlabel.gif) right 15% no-repeat; }
|
||||
|
||||
#imageDataContainer{ font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0 auto; line-height: 1.4em; overflow: auto; width: 100% ; }
|
||||
|
||||
#imageData{ padding:0 10px; color: #666; }
|
||||
#imageData #imageDetails{ width: 70%; float: left; text-align: left; }
|
||||
#imageData #caption{ font-weight: bold; }
|
||||
#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; }
|
||||
#imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; outline: none;}
|
||||
|
||||
#overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }
|
||||
24
dx.php
Normal file
24
dx.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?
|
||||
define('ADRES','sql.atm.home.pl');
|
||||
define('UZYTKOWNIK','atm3');
|
||||
define('HASLO_DO_BAZY','alan87');
|
||||
define('BAZA','atm3');
|
||||
|
||||
|
||||
define('BLAD','<font color=red><b>B £ ¡ D !</b></font>');
|
||||
|
||||
/* ################################
|
||||
###################################
|
||||
#### USTAWIENIA ########
|
||||
###################################
|
||||
################################*/
|
||||
|
||||
|
||||
$color1='#E5E5E5';
|
||||
$color2='#F3F3F3';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
46
eksport_harmonogram.php
Normal file
46
eksport_harmonogram.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
$data1 = $_POST['data1'];
|
||||
$data2 = $_POST['data2'];
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
|
||||
|
||||
$select = "select a.data_ham As Data,b.nazwisko As Nazwisko,b.imie As Imie,c.akcja As Akcja,d.bank As Bank,a.nrzlecenia As Nr_zlecenia,a.godzina As Godzina,a.nrseryjny As Nr_seryjny,a.typ As Typ,a.ulica As Ulica,a.miasto As Miasto from harmonogram a,uzytkownicy b,akcja c,bank d where a.id=b.id and a.id_akc=c.id_akc and a.id_ban=d.id_ban and a.usun='0' and a.data_ham >= '".$_POST['data1']."' and a.data_ham <= '".$_POST['data2']."'order by data_ham desc";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value))) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=Harmonogram " . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
60
eksport_raport.php
Normal file
60
eksport_raport.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
$data1 = $_POST['data1'];
|
||||
$data2 = $_POST['data2'];
|
||||
|
||||
//PM
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT a.nrzlecenia AS W0, a.nrseryjny AS Identyfikator, a.data AS
|
||||
DATA , a.miejscowosc AS Miasto, a.ulica AS Ulica, c.akcja AS Akcja, d.bank AS Bank, b.nazwisko AS Nazwisko, b.imie AS Imie
|
||||
FROM raporty a, uzytkownicy b, akcja c, bank d
|
||||
WHERE a.id = b.id
|
||||
AND a.id_akc = c.id_akc
|
||||
AND a.id_ban = d.id_ban
|
||||
AND a.usun = '0'
|
||||
AND c.id_akc = '21'
|
||||
AND a.dopuszczony = '1'
|
||||
AND a.zrobiony = '1'
|
||||
AND a.przystapiono = '1'
|
||||
AND a.data >= '".$_POST['data1']."'
|
||||
AND a.data <= '".$_POST['data2']."'
|
||||
ORDER BY a.data ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value)) OR ($value == "")) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=PM " . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
59
eksport_raport_all.php
Normal file
59
eksport_raport_all.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
$data1 = $_POST['data1'];
|
||||
$data2 = $_POST['data2'];
|
||||
|
||||
//PM
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT
|
||||
a.nrzlecenia AS W0,a.nrseryjny AS Identyfikator,a.data AS Data,a.miejscowosc as Miasto,a.ulica as Ulica,TIMEDIFF(godzzak,godzroz) as Czas_Naprawy,c.akcja As Akcja,d.bank as Bank,a.uwagi As Uwagi,b.nazwisko as Nazwisko,b.imie as Imie FROM raporty a, uzytkownicy b, akcja c, bank d
|
||||
WHERE a.id = b.id
|
||||
AND a.id_akc = c.id_akc
|
||||
AND a.id_ban = d.id_ban
|
||||
AND a.usun = '0'
|
||||
and a.dopuszczony='1'
|
||||
and a.zrobiony='1'
|
||||
And c.id_akc <> '16'
|
||||
and a.przystapiono='1'
|
||||
AND a.data >= '".$_POST['data1']."'
|
||||
AND a.data <= '".$_POST['data2']."'
|
||||
ORDER BY a.data ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if (!isset($value)) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=ALL " . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
59
eksport_raport_pm.php
Normal file
59
eksport_raport_pm.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
$data1 = $_POST['data1'];
|
||||
$data2 = $_POST['data2'];
|
||||
|
||||
//PM
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT
|
||||
a.nrzlecenia AS W0,a.nrseryjny AS Identyfikator,a.data AS Data,a.miejscowosc as Miasto,a.ulica as Ulica,TIMEDIFF(godzzak,godzroz) as Czas_Naprawy,c.akcja As Akcja,d.bank as Bank,b.nazwisko as Nazwisko,b.imie as Imie FROM raporty a, uzytkownicy b, akcja c, bank d
|
||||
WHERE a.id = b.id
|
||||
AND a.id_akc = c.id_akc
|
||||
AND a.id_ban = d.id_ban
|
||||
AND a.usun = '0'
|
||||
And c.id_akc = '21'
|
||||
and a.dopuszczony='1'
|
||||
and a.zrobiony='1'
|
||||
and a.przystapiono='1'
|
||||
AND a.data >= '".$_POST['data1']."'
|
||||
AND a.data <= '".$_POST['data2']."'
|
||||
ORDER BY a.data ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if (!isset($value)) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=PM " . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
544
funkcje.php
Normal file
544
funkcje.php
Normal file
@ -0,0 +1,544 @@
|
||||
|
||||
<?
|
||||
if($instal!='tak')
|
||||
require("dx.php");
|
||||
require("funkcje_show.php");
|
||||
function lacz_baza ()
|
||||
|
||||
{
|
||||
|
||||
$db=mysql_connect(ADRES,UZYTKOWNIK,HASLO_DO_BAZY);
|
||||
|
||||
$wyb=mysql_select_db(BAZA);
|
||||
|
||||
|
||||
|
||||
return $db;
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_dane_do_logowania($dane)
|
||||
|
||||
{
|
||||
|
||||
if(!eregi('^[a-zA-Z0-9]+$',$dane))
|
||||
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_liczbe($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]+$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_email($email)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "^[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*";
|
||||
|
||||
$wyr .= "@([a-zA-Z0-9_-]+)(\.[a-zA-Z0-9_-]+)*(\.[a-zA-Z]{2,4})$";
|
||||
|
||||
if(ereg($wyr, $email)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_kod($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]{2,2}-[0-9]{3,3}$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_koszt($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]*.[0-9]{2,2}$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_bak($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]*/[0-9]{1,1}$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_date($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]{4,4}-[0-9]{2,2}-[0-9]{2,2}$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_czas($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]{2,2}:[0-9]{2,2}$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_rok($kod)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "'^[0-9]{4,4}$'";
|
||||
|
||||
if(preg_match($wyr, $kod)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sprawdz_telefon($telefon)
|
||||
|
||||
{
|
||||
|
||||
$wyr = "''";
|
||||
|
||||
if(preg_match($wyr, $telefon)){
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
else{
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function zaloguj_uzytkownika($login,$haslo) // logowanie uzytkownika .. pobieranie danych z bazy i sprawdzanie
|
||||
|
||||
{
|
||||
|
||||
if(!($w=lacz_baza(ADRES,UZYTKOWNIK,HASLO_DO_BAZY,BAZA))) return false;
|
||||
|
||||
$wynik =mysql_query("select * from uzytkownicy where login='".$login."' AND haslo='".md5($haslo)."' and blok='NIE' and usun='0'");
|
||||
|
||||
if(!$wynik)
|
||||
|
||||
return false;
|
||||
|
||||
if(mysql_num_rows($wynik)>0)
|
||||
|
||||
return true;
|
||||
|
||||
else
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function uprawnienia($zmienna)
|
||||
|
||||
{
|
||||
|
||||
$tab=explode('-',$zmienna);
|
||||
|
||||
if($tab[0]==1)
|
||||
|
||||
$upr['harmonogram']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['harmonogram']='NIE';
|
||||
|
||||
if($tab[1]==1)
|
||||
|
||||
$upr['raporty']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['raporty']='NIE';
|
||||
|
||||
if($tab[2]==1)
|
||||
|
||||
$upr['zaliczki']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['zaliczki']='NIE';
|
||||
|
||||
if($tab[3]==1)
|
||||
|
||||
$upr['kilometry']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['kilometry']='NIE';
|
||||
|
||||
if($tab[4]==1)
|
||||
|
||||
$upr['tankowania']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['tankowania']='NIE';
|
||||
|
||||
if($tab[5]==1)
|
||||
|
||||
$upr['zestawienia']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['zestawienia']='NIE';
|
||||
|
||||
if($tab[6]==1)
|
||||
|
||||
$upr['samochod']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['samochod']='NIE';
|
||||
|
||||
if($tab[7]==1)
|
||||
|
||||
$upr['ustawienia']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['ustawienia']='NIE';
|
||||
|
||||
if($tab[8]==1)
|
||||
|
||||
$upr['konta']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['konta']='NIE';
|
||||
|
||||
if($tab[9]==1)
|
||||
|
||||
$upr['vending']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['vending']='NIE';
|
||||
|
||||
|
||||
if($tab[10]==1)
|
||||
|
||||
$upr['magazyn']='TAK';
|
||||
|
||||
else
|
||||
|
||||
$upr['magazyn']='NIE';
|
||||
|
||||
return $upr;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
function zmien_color($color)
|
||||
|
||||
{
|
||||
|
||||
global $color1, $color2;
|
||||
|
||||
if($color==$color1)
|
||||
|
||||
return $color2;
|
||||
|
||||
else
|
||||
|
||||
return $color1;
|
||||
|
||||
}
|
||||
|
||||
function zaladuj_plik($upload_plik,$katalog,$rozszerzenia)
|
||||
|
||||
{
|
||||
|
||||
// funkcja pobiera parametry
|
||||
|
||||
// $upload plik - plik ktory ma zostac zapisany na serwerze
|
||||
|
||||
// $katalog - katalog do ktorego ma zostac zapisany plik
|
||||
|
||||
// $orzszerzenia - tablica w ktorej sa dostepne rozszerzenia dla pliku
|
||||
|
||||
|
||||
|
||||
// funkcja zwraca tablice
|
||||
|
||||
// $tab['blad'] - jezeli wystapił blad przy zalafowaniu pliku bedzie go mozna stad odczytac
|
||||
|
||||
// $tab['sciezka'] - sciezka do pliku gdzie został załadowany plik
|
||||
|
||||
$tab=false;
|
||||
|
||||
if (uploaded_file_logo($upload_plik['tmp_name']))
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
$plik=$upload_plik['tmp_name'];
|
||||
|
||||
$plik_nazwa=$upload_plik['name'];
|
||||
|
||||
$plik_type=$upload_plik['type'];
|
||||
|
||||
$plik_error=$upload_plik['error'];
|
||||
|
||||
|
||||
|
||||
if($plik_error>0)
|
||||
|
||||
{
|
||||
|
||||
switch($plik_error)
|
||||
|
||||
{
|
||||
|
||||
case 1: $tab['blad']='Rozmiar pliku przekroczył wartosc ustawioną przez serwer!'; break;
|
||||
|
||||
case 2: $tab['blad']='Rozmiar pliku przekroczył wartosc ustawioną w formularzu!'; break;
|
||||
|
||||
case 3: $tab['blad']='Plik wysłany tylko częsciowo!'; break;
|
||||
|
||||
case 4: $tab['blad']='Nie wysłano zadnego pliku!'; break;
|
||||
|
||||
}//switch
|
||||
|
||||
}//if plik error
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$typ=substr($plik_nazwa,-3);
|
||||
|
||||
foreach($rozszerzenia as $wartosci)
|
||||
|
||||
{
|
||||
|
||||
if($wartosci==$typ)
|
||||
|
||||
{
|
||||
|
||||
$poprawne_rozszerzenie=true;
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
$poprawne_rozszerzenie=false;
|
||||
|
||||
}
|
||||
|
||||
if(!$poprawne_rozszerzenie)
|
||||
|
||||
{
|
||||
|
||||
$tab['blad']='Wybrany plik jest błędny. Jego format jest niepoprawny!';
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$plik_nazwa=str_replace(' ','_',$plik_nazwa);
|
||||
|
||||
// tworzenie sciezki do zapisania zdjecia czy loga
|
||||
|
||||
$sciezka=$katalog.'/'.$plik_nazwa;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$upload=@move_uploaded_file($plik,$sciezka);
|
||||
|
||||
if($upload)
|
||||
|
||||
$tab['udalo_sie']=true;
|
||||
|
||||
else
|
||||
|
||||
$tab['udalo_sie']=false;
|
||||
|
||||
$tab['sciezka']=$sciezka;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}//else
|
||||
|
||||
}//else
|
||||
|
||||
} //is_uploaded_file
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$tab['blad']='Nie wybrałeś zadnego pliku!' ;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return $tab;
|
||||
|
||||
}
|
||||
|
||||
function mail_html($do,$temat,$tresc,$dodatkowy_naglowek)
|
||||
|
||||
{
|
||||
|
||||
$headers.= "MIME-Version: 1.0\r\n";
|
||||
|
||||
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
|
||||
|
||||
$headers.=$dodatkowy_naglowek;
|
||||
|
||||
$ok=mail($do,$temat,$tresc,$headers);
|
||||
|
||||
if($ok)
|
||||
|
||||
return true;
|
||||
|
||||
else
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
7724
funkcje_show.php
Normal file
7724
funkcje_show.php
Normal file
File diff suppressed because it is too large
Load Diff
11
funkcje_show.php.add
Normal file
11
funkcje_show.php.add
Normal file
@ -0,0 +1,11 @@
|
||||
<LASTEDITED BY="Tomek"/>
|
||||
<OPTION NAME="WORDWRAP" STATE="ON"/>
|
||||
<OPTION NAME="LINENUMBERS" STATE="ON"/>
|
||||
<OPTION NAME="SHOWALLCHARS" STATE="OFF"/>
|
||||
<OPTION NAME="DIVIDEEDITOR" STATE="SINGLE"/>
|
||||
<OPTION NAME="WYSIWYGMODE" STATE="OFF"/>
|
||||
<LIVESPELL ENABLED="OFF"/>
|
||||
<PARSER NAME="HTML+PHP extended"/>
|
||||
<POSITION LINE="3565" CHAR="0"/>
|
||||
<SELECTION START="93373" LENGTH="0"/>
|
||||
<BOOKMARK TYPE="NORMAL" NUMBER="10" LINE="3621" COL="60"/>
|
||||
721
graph.php
Normal file
721
graph.php
Normal file
@ -0,0 +1,721 @@
|
||||
<?php
|
||||
|
||||
|
||||
// mPDF 4.5.009
|
||||
define("FF_USERFONT", 15); // See jpgraph_ttf.inc.php for font IDs
|
||||
global $JpgUseSVGFormat;
|
||||
$JpgUseSVGFormat = true;
|
||||
|
||||
//======================================================================================================
|
||||
// DELETE OLD GRAPH FILES FIRST - Housekeeping
|
||||
// First clear any files in directory that are >1 hrs old
|
||||
$interval = 3600;
|
||||
if ($handle = opendir(_MPDF_PATH.'graph_cache')) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (((filemtime(_MPDF_PATH.'graph_cache/'.$file)+$interval) < time()) && ($file != "..") && ($file != ".")) {
|
||||
@unlink(_MPDF_PATH.'graph_cache/'.$file); // mPDF 4.0
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
//==============================================================================================================
|
||||
// LOAD GRAPHS
|
||||
|
||||
include_once(_JPGRAPH_PATH.'jpgraph.php');
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_line.php' );
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_log.php' );
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_scatter.php' );
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_regstat.php' );
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_pie.php');
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_pie3d.php');
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_bar.php');
|
||||
include_once(_JPGRAPH_PATH.'jpgraph_radar.php');
|
||||
|
||||
|
||||
//======================================================================================================
|
||||
//*****************************************************************************************************
|
||||
//*****************************************************************************************************
|
||||
//*****************************************************************************************************
|
||||
//*****************************************************************************************************
|
||||
//*****************************************************************************************************
|
||||
//*****************************************************************************************************
|
||||
//======================================================================================================
|
||||
//======================================================================================================
|
||||
|
||||
//======================================================================================================
|
||||
//======================================================================================================
|
||||
|
||||
//======================================================================================================
|
||||
function print_graph($g,$pgwidth) {
|
||||
$splines = false;
|
||||
$bandw = false;
|
||||
$percent = false;
|
||||
$show_percent = false;
|
||||
$stacked = false;
|
||||
$h = false;
|
||||
$show_values = false;
|
||||
$hide_grid = false;
|
||||
$hide_y_axis = false;
|
||||
|
||||
if (isset($g['attr']['TYPE']) && $g['attr']['TYPE']) { $type = strtolower($g['attr']['TYPE']); }
|
||||
if (!in_array($type,array('bar','horiz_bar','line','radar','pie','pie3d','xy','scatter'))) { $type = 'bar'; } // Default=bar
|
||||
|
||||
if (isset($g['attr']['STACKED']) && $g['attr']['STACKED']) { $stacked = true; } // stacked for bar or horiz_bar
|
||||
if (isset($g['attr']['SPLINES']) && $g['attr']['SPLINES'] && $type=='xy') { $splines = true; } // splines for XY line graphs
|
||||
if (isset($g['attr']['BANDW']) && $g['attr']['BANDW']) { $bandw = true; } // black and white
|
||||
if (isset($g['attr']['LEGEND-OVERLAP']) && $g['attr']['LEGEND-OVERLAP']) { $overlap = true; } // avoid overlap of Legends over graph (line, bar, horiz_bar only)
|
||||
if (isset($g['attr']['PERCENT']) && $g['attr']['PERCENT'] && $type != 'xy' && $type != 'scatter') { $percent = true; } // Show data series as percent of total in series
|
||||
if (isset($g['attr']['SHOW-VALUES']) && $g['attr']['SHOW-VALUES']) { $show_values = true; } // Show the individual data values
|
||||
if (isset($g['attr']['HIDE-GRID']) && $g['attr']['HIDE-GRID']) { $hide_grid = true; } // Hide the y-axis gridlines
|
||||
if (isset($g['attr']['HIDE-Y-AXIS']) && $g['attr']['HIDE-Y-AXIS']) { $hide_y_axis = true; } // Hide the y-axis
|
||||
|
||||
|
||||
// Antialias: If true - better quality curves, but graph line will only be 1px even in PDF 300dpi
|
||||
// default=true for most except line and radar
|
||||
if (isset($g['attr']['ANTIALIAS']) && ($g['attr']['ANTIALIAS']=='' || $g['attr']['ANTIALIAS']==0)) { $antialias = false; }
|
||||
else if (isset($g['attr']['ANTIALIAS']) && $g['attr']['ANTIALIAS'] > 0) { $antialias = true; }
|
||||
else if ($type=='line' || $type=='radar') { $antialias = false; }
|
||||
else { $antialias = true; }
|
||||
|
||||
if ($g['attr']['DPI']) { $dpi = intval($g['attr']['DPI']); }
|
||||
if (!$dpi || $dpi < 50 || $dpi > 2400) { $dpi = 150; } // Default dpi 150
|
||||
$k = (0.2645/25.4 * $dpi);
|
||||
|
||||
// mPDF 4.5.009
|
||||
global $JpgUseSVGFormat;
|
||||
if (isset($JpgUseSVGFormat) && $JpgUseSVGFormat) {
|
||||
$img_type = 'svg';
|
||||
$k = 1; // Overrides as Vector scale does not need DPI
|
||||
}
|
||||
else {
|
||||
$img_type = 'png';
|
||||
}
|
||||
|
||||
if (isset($g['attr']['TITLE']) && $g['attr']['TITLE']) { $title = $g['attr']['TITLE']; }
|
||||
|
||||
if (isset($g['attr']['LABEL-X']) && $g['attr']['LABEL-X']) { $xlabel = $g['attr']['LABEL-X']; } // NOT IMPLEMENTED??????
|
||||
if (isset($g['attr']['LABEL-Y']) && $g['attr']['LABEL-Y']) { $ylabel = $g['attr']['LABEL-Y']; }
|
||||
|
||||
if (isset($g['attr']['AXIS-X']) && $g['attr']['AXIS-X']) { $xaxis = strtolower($g['attr']['AXIS-X']); }
|
||||
if (!in_array($xaxis,array('text','lin','linear','log'))) { $xaxis = 'text'; } // Default=text
|
||||
if ($xaxis == 'linear') { $xaxis = 'lin'; }
|
||||
|
||||
if (isset($g['attr']['AXIS-Y']) && $g['attr']['AXIS-Y']) { $yaxis = strtolower($g['attr']['AXIS-Y']); }
|
||||
if (!in_array($yaxis,array('lin','linear','log','percent'))) { $yaxis = 'lin'; } // Default=lin
|
||||
if ($yaxis == 'percent') { $show_percent = true; $yaxis = 'lin'; } // Show percent sign on scales
|
||||
if ($yaxis == 'linear') { $yaxis = 'lin'; }
|
||||
|
||||
if ($splines) { $xaxis = 'lin'; }
|
||||
$axes = $xaxis.$yaxis; // e.g.textlin, textlog, loglog, loglin, linlog (XY)
|
||||
|
||||
// mPDF 4.0
|
||||
if (isset($g['attr']['cWIDTH']) && $g['attr']['cWIDTH']) { $w=($g['attr']['cWIDTH'] / 0.2645); } // pixels
|
||||
if (isset($g['attr']['cHEIGHT']) && $g['attr']['cHEIGHT']) { $h=($g['attr']['cHEIGHT'] / 0.2645); }
|
||||
|
||||
|
||||
if (isset($g['attr']['SERIES']) && strtolower($g['attr']['SERIES']) == 'rows') { $dataseries = 'rows'; }
|
||||
else { $dataseries = 'cols'; }
|
||||
|
||||
// Defaults - define data
|
||||
$rowbegin = 2;
|
||||
$colbegin = 2;
|
||||
if($type=='scatter' || $type=='xy') {
|
||||
if ($dataseries == 'rows') { $rowbegin = 1; }
|
||||
else { $colbegin = 1; }
|
||||
}
|
||||
$rowend = 0;
|
||||
$colend = 0;
|
||||
|
||||
if (isset($g['attr']['DATA-ROW-BEGIN']) && ($g['attr']['DATA-ROW-BEGIN'] === '0' || $g['attr']['DATA-ROW-BEGIN'] > 0)) { $rowbegin = $g['attr']['DATA-ROW-BEGIN']; }
|
||||
|
||||
if (isset($g['attr']['DATA-COL-BEGIN']) && ($g['attr']['DATA-COL-BEGIN'] === '0' || $g['attr']['DATA-COL-BEGIN'] > 0)) { $colbegin = $g['attr']['DATA-COL-BEGIN']; }
|
||||
|
||||
if (isset($g['attr']['DATA-ROW-END']) && ($g['attr']['DATA-ROW-END'] === '0' || $g['attr']['DATA-ROW-END'] <> 0)) { $rowend = $g['attr']['DATA-ROW-END']; }
|
||||
if (isset($g['attr']['DATA-COL-END']) && ($g['attr']['DATA-COL-END'] === '0' || $g['attr']['DATA-COL-END'] <> 0)) { $colend = $g['attr']['DATA-COL-END']; }
|
||||
|
||||
$nr = count($g['data']);
|
||||
$nc = 0;
|
||||
foreach($g['data'] AS $r) {
|
||||
$cc=0;
|
||||
foreach($r AS $c) { $cc++; }
|
||||
$nc = max($nc,$cc);
|
||||
}
|
||||
if ($colend == 0) { $colend = $nc; }
|
||||
else if ($colend < 0) { $colend = $nc+$colend; }
|
||||
|
||||
if ($rowend == 0) { $rowend = $nr; }
|
||||
else if ($rowend < 0) { $rowend = $nr+$rowend; }
|
||||
|
||||
if ($colend < $colbegin) { $colend = $colbegin; }
|
||||
if ($rowend < $rowbegin) { $rowend = $rowbegin; }
|
||||
|
||||
// if ($type == 'xy' || $type=='scatter') { $colstart=0; }
|
||||
|
||||
// Get Data + Totals
|
||||
$data = array();
|
||||
$totals = array();
|
||||
for ($r=($rowbegin-1);$r<$rowend;$r++) {
|
||||
for ($c=($colbegin-1);$c<$colend;$c++) {
|
||||
if (isset($g['data'][$r][$c])) { $g['data'][$r][$c] = floatval($g['data'][$r][$c] ); }
|
||||
else { $g['data'][$r][$c] = 0; }
|
||||
if ($dataseries=='rows') {
|
||||
$data[($r+1-$rowbegin)][($c+1-$colbegin)] = $g['data'][$r][$c] ;
|
||||
$totals[($r+1-$rowbegin)] += $g['data'][$r][$c] ;
|
||||
}
|
||||
else {
|
||||
$data[($c+1-$colbegin)][($r+1-$rowbegin)] = $g['data'][$r][$c] ;
|
||||
if (isset($totals[($c+1-$colbegin)])) { $totals[($c+1-$colbegin)] += $g['data'][$r][$c] ; }
|
||||
else { $totals[($c+1-$colbegin)] = $g['data'][$r][$c] ; }
|
||||
}
|
||||
}
|
||||
}
|
||||
// PERCENT
|
||||
if ($percent && $type != 'pie' && $type != 'pie3d') {
|
||||
for ($r=0;$r<count($data);$r++) {
|
||||
for ($c=0;$c<count($data[$r]);$c++) {
|
||||
$data[$r][$c] = $data[$r][$c]/$totals[$r] * 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get Legends and labels
|
||||
$legends = array();
|
||||
$labels = array();
|
||||
$longestlegend = 0;
|
||||
$longestlabel = 0;
|
||||
if ($dataseries=='cols') {
|
||||
if ($colbegin>1) {
|
||||
for ($r=($rowbegin-1);$r<$rowend;$r++) {
|
||||
$legends[($r+1-$rowbegin)] = $g['data'][$r][0] ;
|
||||
$longestlegend = max($longestlegend, strlen( $g['data'][$r][0] ));
|
||||
}
|
||||
}
|
||||
if ($rowbegin>1) {
|
||||
for ($c=($colbegin-1);$c<$colend;$c++) {
|
||||
$labels[($c+1-$colbegin)] = $g['data'][0][$c] ;
|
||||
$longestlabel = max($longestlabel , strlen( $g['data'][0][$c] ));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ($dataseries=='rows') {
|
||||
if ($colbegin>1) {
|
||||
for ($r=($rowbegin-1);$r<$rowend;$r++) {
|
||||
$labels[($r+1-$rowbegin)] = $g['data'][$r][0] ;
|
||||
$longestlabel = max($longestlabel , strlen( $g['data'][$r][0] ));
|
||||
}
|
||||
}
|
||||
if ($rowbegin>1) {
|
||||
for ($c=($colbegin-1);$c<$colend;$c++) {
|
||||
$legends[($c+1-$colbegin)] = $g['data'][0][$c] ;
|
||||
$longestlegend = max($longestlegend, strlen( $g['data'][0][$c] ));
|
||||
}
|
||||
}
|
||||
}
|
||||
// Default sizes
|
||||
$defsize = array();
|
||||
$defsize['pie'] = array('w' => 600, 'h' => 300);
|
||||
$defsize['pie3d'] = array('w' => 600, 'h' => 300);
|
||||
$defsize['radar'] = array('w' => 600, 'h' => 300);
|
||||
$defsize['line'] = array('w' => 600, 'h' => 400);
|
||||
$defsize['xy'] = array('w' => 600, 'h' => 400);
|
||||
$defsize['scatter'] = array('w' => 600, 'h' => 400);
|
||||
$defsize['bar'] = array('w' => 600, 'h' => 400);
|
||||
$defsize['horiz_bar'] = array('w' => 600, 'h' => 500);
|
||||
|
||||
|
||||
// Use default ratios
|
||||
if ($w && !$h) { $h = $w*$defsize[$type]['h']/$defsize[$type]['w']; }
|
||||
if ($h && !$w) { $w = $h*$defsize[$type]['w']/$defsize[$type]['h']; }
|
||||
if (!$h && !$w) { $w = $defsize[$type]['w']; $h = $defsize[$type]['h']; }
|
||||
|
||||
|
||||
if (count($data)>0 && $type) {
|
||||
$figure_file = "graph_cache/".rand(11111,999999999).".".$img_type;
|
||||
if ($bandw) { $colours = array('snow1','black','snow4','snow3','snow2','cadetblue4','cadetblue3','cadetblue1','bisque4','bisque2','beige'); }
|
||||
else { $colours = array('cyan','darkorchid4','cadetblue3','khaki1','darkolivegreen2','cadetblue4','coral','cyan4','rosybrown3','wheat1'); }
|
||||
$fills = array('navy','orange','red','yellow','purple','navy','orange','red','yellow','purple');
|
||||
$patterns = array(PATTERN_DIAG1,PATTERN_CROSS1,PATTERN_STRIPE1,PATTERN_DIAG3,PATTERN_CROSS2,PATTERN_DIAG2,PATTERN_DIAG4,PATTERN_CROSS3, PATTERN_CROSS4,PATTERN_STRIPE1);
|
||||
$markers = array(MARK_DIAMOND, MARK_SQUARE, MARK_CIRCLE, MARK_UTRIANGLE, MARK_DTRIANGLE, MARK_FILLEDCIRCLE, MARK_CROSS, MARK_STAR, MARK_X);
|
||||
|
||||
// LEGENDS
|
||||
if ($type == 'pie' || $type == 'pie3d') {
|
||||
$graph = new PieGraph (($w*$k),($h*$k));
|
||||
}
|
||||
else if ($type == 'radar') {
|
||||
$graph = new RadarGraph(($w*$k),($h*$k));
|
||||
}
|
||||
else {
|
||||
$graph = new Graph(($w*$k),($h*$k));
|
||||
}
|
||||
|
||||
// mPDF 4.5.009
|
||||
// $graph->img->SetImgFormat($img_type) ;
|
||||
// if (strtoupper($img_type)=='JPEG') { $graph->img->SetQuality(90); }
|
||||
if ($antialias) { $graph->img->SetAntiAliasing(); }
|
||||
$graph->SetShadow(true, 2*$k);
|
||||
$graph->SetMarginColor("white");
|
||||
// TITLE
|
||||
$graph->title->Set($title);
|
||||
$graph->title->SetMargin(10*$k);
|
||||
$graph->title->SetFont(FF_USERFONT,FS_BOLD,11*$k);
|
||||
$graph->title->SetColor("black");
|
||||
$graph->legend->SetLineSpacing(3*$k);
|
||||
$graph->legend->SetMarkAbsSize(6*$k);
|
||||
$graph->legend->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
|
||||
// Set GRAPH IMAGE MARGINS
|
||||
if ($type == 'pie' || $type == 'pie3d') {
|
||||
$psize = 0.3;
|
||||
$pposxabs = ($w/2);
|
||||
$pposy = 0.55;
|
||||
if ($longestlegend) { // if legend showing
|
||||
$pposxabs -= ((($longestlegend * 5) + 20) / 2);
|
||||
}
|
||||
$pposx = ($pposxabs / $w);
|
||||
$graph->legend->Pos(0.02,0.5,'right','center');
|
||||
}
|
||||
else if ($type == 'radar') {
|
||||
$psize = 0.5;
|
||||
$pposxabs = ($w/2);
|
||||
$pposy = 0.55;
|
||||
if ($longestlabel) { // if legend showing
|
||||
$pposxabs -= ((($longestlabel * 5) + 20) / 2);
|
||||
}
|
||||
$pposx = ($pposxabs / $w);
|
||||
$graph->legend->Pos(0.02,0.5,'right','center');
|
||||
}
|
||||
else if ($type == 'xy' || $type == 'scatter') {
|
||||
$pml = 50;
|
||||
$pmr = 20;
|
||||
$pmt = 60;
|
||||
$pmb = 50;
|
||||
$xaxislblmargin = $pmb - 30;
|
||||
$yaxislblmargin = $pml - 15;
|
||||
$graph->legend->Pos(0.02,0.1,'right','top');
|
||||
}
|
||||
else if ($type == 'line' || $type == 'bar') {
|
||||
$pml = 50;
|
||||
$pmr = 20;
|
||||
$pmt = 60;
|
||||
$pmb = 50;
|
||||
$xlangle = 0;
|
||||
$ll = ($longestlegend * 5); // 45 degrees 8pt fontsize
|
||||
if ($ll > 5 || ($ll>3 && count($data)>10)) {
|
||||
$pmb = max($pmb, $ll + 30);
|
||||
$xlangle = 50;
|
||||
}
|
||||
$xaxislblmargin = $pmb - 30;
|
||||
$yaxislblmargin = $pml - 15;
|
||||
if ($longestlabel && !$overlap) { // if legend showing
|
||||
$pmr = ((($longestlabel * 5) + 40));
|
||||
}
|
||||
$graph->legend->Pos(0.02,0.1,'right','top');
|
||||
}
|
||||
else if ($type == 'horiz_bar') {
|
||||
$pml = 50;
|
||||
$pmr = 20;
|
||||
$pmt = 50;
|
||||
$pmb = 45;
|
||||
$ll = ($longestlegend * 6.5); // 8pt fontsize
|
||||
$pml = max($pml, $ll + 20);
|
||||
$xaxislblmargin = $pml - 20;
|
||||
$yaxislblmargin = $pmb - 15;
|
||||
if ($longestlabel && !$overlap) { // if legend showing
|
||||
$pmr = ((($longestlabel * 5) + 40));
|
||||
}
|
||||
$graph->legend->Pos(0.02,0.1,'right','top');
|
||||
}
|
||||
|
||||
|
||||
// DRAW THE GRAPHS
|
||||
if ($type == 'pie') {
|
||||
$p1 = new PiePlot($data[0]);
|
||||
$p1->SetSliceColors($colours);
|
||||
|
||||
if ($show_values) {
|
||||
$p1->value->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
if ($percent) { $p1->SetLabelType(PIE_VALUE_PERADJ); } //PIE_VAL_PER = default
|
||||
else { $p1->SetLabelType(PIE_VALUE_ABS); }
|
||||
if ($percent || $show_percent) { $p1->value->SetFormat("%d%%"); }
|
||||
else { $p1->value->SetFormat("%s"); }
|
||||
// Enable and set policy for guide-lines. Make labels line up vertically
|
||||
$p1->SetGuideLines(true);
|
||||
$p1->SetGuideLinesAdjust(1.5);
|
||||
}
|
||||
else { $p1->value->Show(false); }
|
||||
$p1->SetLegends($legends);
|
||||
$p1->SetSize($psize);
|
||||
$p1->SetCenter($pposx, $pposy);
|
||||
if ($labels[0]) {
|
||||
$graph->subtitle->Set($labels[0]);
|
||||
$graph->subtitle->SetMargin(10*$k);
|
||||
$graph->subtitle->SetFont(FF_USERFONT,FS_BOLD,11*$k);
|
||||
$graph->subtitle->SetColor("black");
|
||||
}
|
||||
$graph->Add($p1);
|
||||
}
|
||||
else if ($type == 'pie3d') {
|
||||
$p1 = new PiePlot3d($data[0]);
|
||||
$p1->SetSliceColors($colours);
|
||||
if ($show_values) {
|
||||
$p1->value->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
if ($percent) { $p1->SetLabelType(PIE_VALUE_PERADJ); } //PIE_VAL_PER = default
|
||||
else { $p1->SetLabelType(PIE_VALUE_ABS); }
|
||||
if ($percent || $show_percent) { $p1->value->SetFormat("%d%%"); }
|
||||
else { $p1->value->SetFormat("%s"); }
|
||||
}
|
||||
else { $p1->value->Show(false); }
|
||||
$p1->SetLegends($legends);
|
||||
$p1->SetEdge();
|
||||
$p1->SetSize($psize);
|
||||
$p1->SetCenter($pposx, $pposy);
|
||||
|
||||
if ($labels[0]) {
|
||||
$graph->subtitle->Set($labels[0]);
|
||||
$graph->subtitle->SetMargin(10*$k);
|
||||
$graph->subtitle->SetFont(FF_USERFONT,FS_BOLD,11*$k);
|
||||
$graph->subtitle->SetColor("black");
|
||||
}
|
||||
|
||||
$graph->Add( $p1);
|
||||
}
|
||||
// RADAR
|
||||
else if ($type == 'radar') {
|
||||
$graph->SetSize($psize);
|
||||
$graph->SetPos($pposx, $pposy);
|
||||
|
||||
$graph->SetTitles( $legends); // labels each axis
|
||||
|
||||
$graph->axis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->axis->title->SetMargin(5*$k);
|
||||
$graph->axis->SetWeight(1*$k);
|
||||
$graph->axis->HideLabels();
|
||||
$graph->axis->SetFont(FF_USERFONT,FS_NORMAL,6*$k);
|
||||
$graph->HideTickMarks();
|
||||
|
||||
$group = array();
|
||||
foreach($data AS $series => $dat) {
|
||||
$rdata = array();
|
||||
foreach($data[$series] AS $row) { $rdata[] = $row; }
|
||||
if (count($rdata)<3) { die("ERROR::Graph::Cannot create a Radar Plot with less than 3 data points."); }
|
||||
// Create the radar plot
|
||||
$bplot = new RadarPlot($rdata);
|
||||
$bplot->mark->SetType($markers[$series]);
|
||||
$bplot->mark->SetFillColor($colours[$series]);
|
||||
$bplot->mark->SetWidth(3*$k);
|
||||
$bplot->SetColor($colours[$series]);
|
||||
if ($series == 0) { $bplot->SetFillColor('lightred'); }
|
||||
else { $bplot->SetFill(false); }
|
||||
$bplot->SetLineWeight(1*$k);
|
||||
$bplot->SetLegend($labels[$series]);
|
||||
if ($bandw) { $bplot->SetShadow("gray5"); }
|
||||
$graph->Add($bplot);
|
||||
}
|
||||
}
|
||||
// LINE
|
||||
else if ($type == 'line') {
|
||||
// Setup the graph.
|
||||
$graph->img->SetMargin($pml*$k,$pmr*$k,$pmt*$k,$pmb*$k); // LRTB
|
||||
$graph->SetScale($axes);
|
||||
$graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
|
||||
if ($ylabel) {
|
||||
$graph->yaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->yaxis->SetTitle($ylabel,'middle');
|
||||
$graph->yaxis->SetTitleMargin($yaxislblmargin*$k);
|
||||
}
|
||||
|
||||
$graph->yaxis->SetLabelMargin(4*$k);
|
||||
if ($percent || $show_percent) { $graph->yaxis->SetLabelFormat('%d%%'); } // Percent
|
||||
|
||||
// Show 0 label on Y-axis (default is not to show)
|
||||
$graph->yscale->ticks->SupressZeroLabel(true);
|
||||
if ($hide_y_axis) { $graph->yaxis->Hide(); }
|
||||
if ($hide_grid) { $graph->ygrid->Show(false); }
|
||||
|
||||
// Setup X-axis labels
|
||||
$graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->SetTickLabels($legends);
|
||||
$graph->xaxis->SetLabelAngle($xlangle);
|
||||
$graph->xaxis->SetLabelMargin(4*$k);
|
||||
// X-axis title
|
||||
if ($xlabel) {
|
||||
$graph->xaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->SetTitle($xlabel,'middle');
|
||||
$graph->xaxis->SetTitleMargin($xaxislblmargin*$k);
|
||||
}
|
||||
foreach($data AS $series => $rdata) {
|
||||
$bplot = new LinePlot($rdata);
|
||||
$bplot->mark->SetType($markers[$series]);
|
||||
$bplot->mark->SetFillColor($colours[$series]);
|
||||
$bplot->mark->SetWidth(4*$k);
|
||||
if ($show_values) {
|
||||
$bplot->value-> Show(); // Not if scatter
|
||||
$bplot->value->SetMargin(6*$k);
|
||||
$bplot->value->SetColor("darkred");
|
||||
$bplot->value->SetFont( FF_USERFONT, FS_NORMAL, 8*$k);
|
||||
if ($percent || $show_percent) { $bplot->value->SetFormat( '%d%%'); }
|
||||
else { $bplot->value->SetFormat("%s"); }
|
||||
}
|
||||
// Set color for each line
|
||||
$bplot->SetColor($colours[$series]);
|
||||
$bplot->SetWeight(2*$k);
|
||||
$bplot->SetLegend($labels[$series]);
|
||||
if ($bandw) { $bplot->SetShadow("gray5"); }
|
||||
// Indent the X-scale so the first and last point doesn't fall on the edges
|
||||
$bplot->SetCenter();
|
||||
$graph->Add($bplot);
|
||||
}
|
||||
|
||||
}
|
||||
// XY or SCATTER
|
||||
else if ($type == 'xy' || $type == 'scatter') {
|
||||
// Setup the graph.
|
||||
$graph->img->SetMargin($pml*$k,$pmr*$k,$pmt*$k,$pmb*$k); // LRTB
|
||||
$graph->SetScale($axes);
|
||||
// Setup font for axis
|
||||
$graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
// Y-axis title
|
||||
if ($labels[1]) {
|
||||
$graph->yaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->yaxis->SetTitleMargin($yaxislblmargin*$k);
|
||||
$graph->yaxis->SetTitle($labels[1],'middle');
|
||||
}
|
||||
|
||||
|
||||
$graph->yaxis->SetLabelMargin(4*$k);
|
||||
if ($percent || $show_percent) { $graph->yaxis->SetLabelFormat('%d%%'); } // Percent
|
||||
|
||||
// Show 0 label on Y-axis (default is not to show)
|
||||
$graph->yscale->ticks->SupressZeroLabel(true);
|
||||
// Just let the maximum be autoscaled
|
||||
$graph->yaxis->scale->SetAutoMin(0);
|
||||
if ($hide_y_axis) { $graph->yaxis->Hide(); }
|
||||
if ($hide_grid) { $graph->ygrid->Show(false); }
|
||||
|
||||
// Setup X-axis labels
|
||||
$graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
// mPDF 2.5 Corrects labelling of x-axis
|
||||
// $graph->xaxis->SetTickLabels($legends);
|
||||
$graph->xaxis->SetLabelAngle(50);
|
||||
$graph->xaxis->SetLabelMargin(4*$k);
|
||||
// X-axis title
|
||||
if ($labels[0]) {
|
||||
$graph->xaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->SetTitleMargin($xaxislblmargin*$k);
|
||||
$graph->xaxis->SetTitle($labels[0],'middle');
|
||||
}
|
||||
|
||||
// Create the bar plot
|
||||
// SPLINES
|
||||
if ($splines && $type=='xy') {
|
||||
$spline = new Spline($data[0],$data[1]);
|
||||
list($newx,$newy) = $spline->Get(100);
|
||||
}
|
||||
else {
|
||||
$newx = $data[0];
|
||||
$newy = $data[1];
|
||||
}
|
||||
|
||||
if ($type=='xy') {
|
||||
// LINE PLOT
|
||||
$bplot = new LinePlot($newy, $newx);
|
||||
// Set color for each line
|
||||
$bplot->SetColor($fills[0]);
|
||||
$bplot->SetWeight(4*$k);
|
||||
if ($bandw) { $bplot->SetShadow("gray5"); }
|
||||
$graph->Add($bplot);
|
||||
}
|
||||
|
||||
// SCATTER PLOT
|
||||
$cplot = new ScatterPlot($data[1], $data[0]);
|
||||
|
||||
$cplot->mark->SetType($markers[0]);
|
||||
$cplot->mark->SetFillColor($fills[0]);
|
||||
$cplot->mark->SetWidth(8*$k);
|
||||
if ($show_values) {
|
||||
// mPDF 2.5
|
||||
if ($type=='xy') { $cplot->value->Show(); } // Not if scatter
|
||||
$cplot->value->SetMargin(8*$k);
|
||||
$cplot->value->SetColor("darkred");
|
||||
$cplot->value->SetFont( FF_USERFONT, FS_NORMAL, 6*$k);
|
||||
|
||||
if ($percent || $show_percent) { $cplot->value->SetFormat( '%d%%'); }
|
||||
else { $cplot->value->SetFormat("%s"); }
|
||||
}
|
||||
|
||||
// Set color for each line
|
||||
$cplot->SetColor($fills[0]);
|
||||
$cplot->SetWeight(4*$k);
|
||||
if ($bandw) { $cplot->SetShadow("gray5"); }
|
||||
$graph->Add($cplot);
|
||||
|
||||
}
|
||||
// BAR
|
||||
else if ($type == 'bar') {
|
||||
// Setup the graph.
|
||||
$graph->img->SetMargin($pml*$k,$pmr*$k,$pmt*$k,$pmb*$k); // LRTB
|
||||
$graph->SetScale($axes);
|
||||
// Setup y-axis
|
||||
$graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
if ($hide_y_axis) { $graph->yaxis->Hide(); }
|
||||
if ($hide_grid) { $graph->ygrid->Show(false); }
|
||||
$graph->yaxis->SetLabelMargin(4*$k);
|
||||
if ($ylabel) {
|
||||
$graph->yaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->yaxis->SetTitle($ylabel,'middle');
|
||||
$graph->yaxis->SetTitleMargin($yaxislblmargin*$k);
|
||||
}
|
||||
// Show 0 label on Y-axis (default is not to show)
|
||||
$graph->yscale->ticks->SupressZeroLabel(false);
|
||||
// Setup X-axis labels
|
||||
$graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->SetTickLabels($legends);
|
||||
$graph->xaxis->SetLabelAngle($xlangle);
|
||||
$graph->xaxis->SetLabelMargin(4*$k);
|
||||
// X-axis title
|
||||
if ($xlabel) {
|
||||
$graph->xaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->SetTitle($xlabel,'middle');
|
||||
$graph->xaxis->SetTitleMargin($xaxislblmargin*$k);
|
||||
}
|
||||
|
||||
$group = array();
|
||||
foreach($data AS $series => $dat) {
|
||||
$rdata = array();
|
||||
foreach($data[$series] AS $row) { $rdata[] = $row; }
|
||||
|
||||
// Create the bar plot
|
||||
$bplot = new BarPlot($rdata);
|
||||
$bplot->SetWidth(0.6); // for SINGLE??
|
||||
// Setup color for gradient fill style
|
||||
if ($bandw) { $bplot->SetPattern( $patterns[$series]); }
|
||||
else { $bplot->SetFillGradient($fills[$series],"#EEEEEE",GRAD_LEFT_REFLECTION); }
|
||||
|
||||
// Set color for the frame of each bar
|
||||
$bplot->SetColor("darkgray");
|
||||
$bplot->SetLegend($labels[$series]);
|
||||
if ($bandw) { $bplot->SetShadow("gray5"); }
|
||||
if ($show_values) {
|
||||
$bplot->value->Show();
|
||||
$bplot->value->SetMargin(6*$k);
|
||||
$bplot->value->SetColor("darkred");
|
||||
$bplot->value->SetFont( FF_USERFONT, FS_NORMAL, 8*$k);
|
||||
if ($percent || $show_percent) { $bplot->value->SetFormat( '%d%%'); }
|
||||
else { $bplot->value->SetFormat("%s"); }
|
||||
}
|
||||
|
||||
$group[] = $bplot;
|
||||
}
|
||||
if (count($data)==1) {
|
||||
$graph->Add($group[0]);
|
||||
}
|
||||
else {
|
||||
// Create the grouped bar plot
|
||||
if ($stacked) {
|
||||
$gbplot = new AccBarPlot ($group);
|
||||
}
|
||||
else {
|
||||
$gbplot = new GroupBarPlot ($group);
|
||||
}
|
||||
$graph->Add($gbplot);
|
||||
}
|
||||
}
|
||||
else if ($type == 'horiz_bar') {
|
||||
$graph->SetScale($axes);
|
||||
$graph->Set90AndMargin($pml*$k,$pmr*$k,$pmt*$k,$pmb*$k); // LRTB
|
||||
|
||||
// Setup y-axis
|
||||
$graph->yaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->yaxis->SetLabelMargin(4*$k);
|
||||
|
||||
$graph->yaxis->SetPos('max'); // Intersect at top of x-axis i.e. y axis is at bottom
|
||||
// First make the labels look right
|
||||
$graph->yaxis->SetLabelAlign('center','top');
|
||||
if ($percent || $show_percent) { $graph->yaxis->SetLabelFormat('%d%%'); }
|
||||
$graph->yaxis->SetLabelSide(SIDE_RIGHT);
|
||||
$graph->yaxis->scale->SetGrace(10); // sets 10% headroom
|
||||
if ($hide_y_axis) { $graph->yaxis->Hide(); }
|
||||
if ($hide_grid) { $graph->ygrid->Show(false); }
|
||||
|
||||
// The fix the tick marks
|
||||
$graph->yaxis->SetTickSide(SIDE_LEFT);
|
||||
if ($ylabel) {
|
||||
$graph->yaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->yaxis->SetTitle($ylabel,'middle');
|
||||
$graph->yaxis->SetTitleMargin($yaxislblmargin*$k);
|
||||
// Finally setup the title
|
||||
$graph->yaxis->SetTitleSide(SIDE_RIGHT);
|
||||
// To align the title to the right use :
|
||||
$graph->yaxis->title->Align('right');
|
||||
$graph->yaxis->title->SetAngle(0);
|
||||
|
||||
}
|
||||
|
||||
// Show 0 label on Y-axis (default is not to show)
|
||||
$graph->yscale->ticks->SupressZeroLabel(false);
|
||||
// Setup X-axis labels
|
||||
$graph->xaxis->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->title->SetAngle(90);
|
||||
$graph->xaxis->SetTickLabels($legends);
|
||||
$graph->xaxis->SetLabelMargin(4*$k);
|
||||
// X-axis title
|
||||
if ($xlabel) {
|
||||
$graph->xaxis->title->SetFont(FF_USERFONT,FS_NORMAL,8*$k);
|
||||
$graph->xaxis->SetTitleMargin($xaxislblmargin*$k);
|
||||
$graph->xaxis->SetTitle($xlabel,'middle');
|
||||
}
|
||||
$group = array();
|
||||
foreach($data AS $series => $dat) {
|
||||
$rdata = array();
|
||||
foreach($data[$series] AS $row) { $rdata[] = $row; }
|
||||
// Create the bar pot
|
||||
$bplot = new BarPlot($rdata);
|
||||
$bplot->SetWidth(0.6); // for SINGLE??
|
||||
// Setup color for gradient fill style
|
||||
if ($bandw) { $bplot->SetPattern( $patterns[$series]); }
|
||||
else { $bplot->SetFillGradient($fills[$series],"#EEEEEE",GRAD_LEFT_REFLECTION); }
|
||||
|
||||
// Set color for the frame of each bar
|
||||
$bplot->SetColor("darkgray");
|
||||
$bplot->SetLegend($labels[$series]);
|
||||
if ($bandw) { $bplot->SetShadow("gray5"); }
|
||||
if ($show_values) {
|
||||
$bplot->value-> Show();
|
||||
$bplot->value->SetMargin(6*$k);
|
||||
$bplot->value->SetColor("darkred");
|
||||
$bplot->value->SetFont( FF_USERFONT, FS_NORMAL, 8*$k);
|
||||
if ($percent || $show_percent) { $bplot->value->SetFormat( '%d%%'); }
|
||||
else { $bplot->value->SetFormat("%s"); }
|
||||
}
|
||||
|
||||
$group[] = $bplot;
|
||||
}
|
||||
if (count($data)==1) {
|
||||
$graph->Add($group[0]);
|
||||
}
|
||||
else {
|
||||
// Create the grouped bar plot
|
||||
if ($stacked) {
|
||||
$gbplot = new AccBarPlot ($group);
|
||||
}
|
||||
else {
|
||||
$gbplot = new GroupBarPlot ($group);
|
||||
}
|
||||
$graph->Add($gbplot);
|
||||
}
|
||||
}
|
||||
if ($graph) {
|
||||
$graph->Stroke( _MPDF_PATH.$figure_file);
|
||||
$srcpath = str_replace("\\","/",dirname(__FILE__)) . "/";
|
||||
$srcpath .= $figure_file;
|
||||
return array('file'=>$srcpath, 'w'=>$w, 'h'=>$h);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//======================================================================================================
|
||||
//======================================================================================================
|
||||
//======================================================================================================
|
||||
//======================================================================================================
|
||||
|
||||
?>
|
||||
1942
harmonogram.php
Normal file
1942
harmonogram.php
Normal file
File diff suppressed because it is too large
Load Diff
1
index.html
Normal file
1
index.html
Normal file
@ -0,0 +1 @@
|
||||
<META HTTP-EQUIV=Refresh CONTENT="0; URL=http://www.malcomm.pl/online/index.php">
|
||||
1
index.html_
Normal file
1
index.html_
Normal file
@ -0,0 +1 @@
|
||||
<META HTTP-EQUIV=Refresh CONTENT="0; URL=http://www.malcomm.pl/online/index.php">
|
||||
5
index.php
Normal file
5
index.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?
|
||||
header("location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/panel.php");
|
||||
exit();
|
||||
|
||||
?>
|
||||
52
info_o_cookie.js
Normal file
52
info_o_cookie.js
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
skrypt napisal Piotr Majewski dla swoich Klientów i Czytelników CNEB.pl
|
||||
do swobodnego używania
|
||||
funkcje setCookie i getCookie zaczerpnięte ze strony http://www.w3schools.com/js/js_cookies.asp
|
||||
i prawa do nich oraz ich rozpowszechniania posiada ich właściciel.
|
||||
|
||||
UWAGA: Jesli widzisz krzaki zamiast polskich znakow, przed skopiowaniem skryptu zmien
|
||||
kodowanie na UTF-8 (zwykle w ustawieniach Widok > Kodowanie)
|
||||
*/
|
||||
|
||||
function setCookie(c_name,value,exdays) {
|
||||
var exdate=new Date();
|
||||
exdate.setDate(exdate.getDate() + exdays);
|
||||
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString()+";path = /");
|
||||
document.cookie=c_name + "=" + c_value;
|
||||
}
|
||||
|
||||
function getCookie(c_name) {
|
||||
var i,x,y,ARRcookies=document.cookie.split(";");
|
||||
for (i=0;i<ARRcookies.length;i++) {
|
||||
x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
|
||||
y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
|
||||
x=x.replace(/^\s+|\s+$/g,"");
|
||||
if (x==c_name) {
|
||||
return unescape(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
setCookie('cookietest',1,1);
|
||||
var CookieTest = getCookie('cookietest');
|
||||
|
||||
if (CookieTest=='1') { // uzytkownik obsluguje cookie
|
||||
|
||||
var Userlanguage = window.navigator.userLanguage || window.navigator.language;
|
||||
var CookieName = 'accept-cookies-from-'+window.location.hostname;
|
||||
var Cookie = getCookie(CookieName);
|
||||
|
||||
if (Cookie=='1') {
|
||||
|
||||
} else {
|
||||
|
||||
if (Userlanguage=='pl') {
|
||||
alert('Ta strona wykorzystuje pliki cookie dla lepszego działania serwisu.\nMożesz zablokować pliki cookie w ustawieniach przeglądarki.\nWięcej informacji w Polityce Prywatności tej strony.');
|
||||
} else {
|
||||
alert('This page uses cookies for better performance of the site.\nYou can disable cookies in your browser settings.\nMore info about cookies in Privacy Policy of this site.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setCookie(CookieName,1,10000);
|
||||
|
||||
}
|
||||
136
js/builder.js
Normal file
136
js/builder.js
Normal file
@ -0,0 +1,136 @@
|
||||
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||||
|
||||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
||||
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||||
|
||||
var Builder = {
|
||||
NODEMAP: {
|
||||
AREA: 'map',
|
||||
CAPTION: 'table',
|
||||
COL: 'table',
|
||||
COLGROUP: 'table',
|
||||
LEGEND: 'fieldset',
|
||||
OPTGROUP: 'select',
|
||||
OPTION: 'select',
|
||||
PARAM: 'object',
|
||||
TBODY: 'table',
|
||||
TD: 'table',
|
||||
TFOOT: 'table',
|
||||
TH: 'table',
|
||||
THEAD: 'table',
|
||||
TR: 'table'
|
||||
},
|
||||
// note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
|
||||
// due to a Firefox bug
|
||||
node: function(elementName) {
|
||||
elementName = elementName.toUpperCase();
|
||||
|
||||
// try innerHTML approach
|
||||
var parentTag = this.NODEMAP[elementName] || 'div';
|
||||
var parentElement = document.createElement(parentTag);
|
||||
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
|
||||
parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
|
||||
} catch(e) {}
|
||||
var element = parentElement.firstChild || null;
|
||||
|
||||
// see if browser added wrapping tags
|
||||
if(element && (element.tagName.toUpperCase() != elementName))
|
||||
element = element.getElementsByTagName(elementName)[0];
|
||||
|
||||
// fallback to createElement approach
|
||||
if(!element) element = document.createElement(elementName);
|
||||
|
||||
// abort if nothing could be created
|
||||
if(!element) return;
|
||||
|
||||
// attributes (or text)
|
||||
if(arguments[1])
|
||||
if(this._isStringOrNumber(arguments[1]) ||
|
||||
(arguments[1] instanceof Array) ||
|
||||
arguments[1].tagName) {
|
||||
this._children(element, arguments[1]);
|
||||
} else {
|
||||
var attrs = this._attributes(arguments[1]);
|
||||
if(attrs.length) {
|
||||
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
|
||||
parentElement.innerHTML = "<" +elementName + " " +
|
||||
attrs + "></" + elementName + ">";
|
||||
} catch(e) {}
|
||||
element = parentElement.firstChild || null;
|
||||
// workaround firefox 1.0.X bug
|
||||
if(!element) {
|
||||
element = document.createElement(elementName);
|
||||
for(attr in arguments[1])
|
||||
element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
|
||||
}
|
||||
if(element.tagName.toUpperCase() != elementName)
|
||||
element = parentElement.getElementsByTagName(elementName)[0];
|
||||
}
|
||||
}
|
||||
|
||||
// text, or array of children
|
||||
if(arguments[2])
|
||||
this._children(element, arguments[2]);
|
||||
|
||||
return element;
|
||||
},
|
||||
_text: function(text) {
|
||||
return document.createTextNode(text);
|
||||
},
|
||||
|
||||
ATTR_MAP: {
|
||||
'className': 'class',
|
||||
'htmlFor': 'for'
|
||||
},
|
||||
|
||||
_attributes: function(attributes) {
|
||||
var attrs = [];
|
||||
for(attribute in attributes)
|
||||
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
|
||||
'="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"');
|
||||
return attrs.join(" ");
|
||||
},
|
||||
_children: function(element, children) {
|
||||
if(children.tagName) {
|
||||
element.appendChild(children);
|
||||
return;
|
||||
}
|
||||
if(typeof children=='object') { // array can hold nodes and text
|
||||
children.flatten().each( function(e) {
|
||||
if(typeof e=='object')
|
||||
element.appendChild(e)
|
||||
else
|
||||
if(Builder._isStringOrNumber(e))
|
||||
element.appendChild(Builder._text(e));
|
||||
});
|
||||
} else
|
||||
if(Builder._isStringOrNumber(children))
|
||||
element.appendChild(Builder._text(children));
|
||||
},
|
||||
_isStringOrNumber: function(param) {
|
||||
return(typeof param=='string' || typeof param=='number');
|
||||
},
|
||||
build: function(html) {
|
||||
var element = this.node('div');
|
||||
$(element).update(html.strip());
|
||||
return element.down();
|
||||
},
|
||||
dump: function(scope) {
|
||||
if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
|
||||
|
||||
var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
|
||||
"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
|
||||
"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
|
||||
"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
|
||||
"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
|
||||
"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
|
||||
|
||||
tags.each( function(tag){
|
||||
scope[tag] = function() {
|
||||
return Builder.node.apply(Builder, [tag].concat($A(arguments)));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
1122
js/effects.js
vendored
Normal file
1122
js/effects.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
497
js/lightbox.js
Normal file
497
js/lightbox.js
Normal file
@ -0,0 +1,497 @@
|
||||
// -----------------------------------------------------------------------------------
|
||||
//
|
||||
// Lightbox v2.04
|
||||
// by Lokesh Dhakar - http://www.lokeshdhakar.com
|
||||
// Last Modification: 2/9/08
|
||||
//
|
||||
// For more information, visit:
|
||||
// http://lokeshdhakar.com/projects/lightbox2/
|
||||
//
|
||||
// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
|
||||
// - Free for use in both personal and commercial projects
|
||||
// - Attribution requires leaving author name, author link, and the license info intact.
|
||||
//
|
||||
// Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
|
||||
// Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
|
||||
//
|
||||
// -----------------------------------------------------------------------------------
|
||||
/*
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
Configuration
|
||||
|
||||
Lightbox Class Declaration
|
||||
- initialize()
|
||||
- updateImageList()
|
||||
- start()
|
||||
- changeImage()
|
||||
- resizeImageContainer()
|
||||
- showImage()
|
||||
- updateDetails()
|
||||
- updateNav()
|
||||
- enableKeyboardNav()
|
||||
- disableKeyboardNav()
|
||||
- keyboardAction()
|
||||
- preloadNeighborImages()
|
||||
- end()
|
||||
|
||||
Function Calls
|
||||
- document.observe()
|
||||
|
||||
*/
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Configurationl
|
||||
//
|
||||
LightboxOptions = Object.extend({
|
||||
fileLoadingImage: 'images/loading.gif',
|
||||
fileBottomNavCloseImage: 'images/closelabel.gif',
|
||||
|
||||
overlayOpacity: 0.8, // controls transparency of shadow overlay
|
||||
|
||||
animate: true, // toggles resizing animations
|
||||
resizeSpeed: 7, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
|
||||
|
||||
borderSize: 10, //if you adjust the padding in the CSS, you will need to update this variable
|
||||
|
||||
// When grouping images this is used to write: Image # of #.
|
||||
// Change it for non-english localization
|
||||
labelImage: "Image",
|
||||
labelOf: "of"
|
||||
}, window.LightboxOptions || {});
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
var Lightbox = Class.create();
|
||||
|
||||
Lightbox.prototype = {
|
||||
imageArray: [],
|
||||
activeImage: undefined,
|
||||
|
||||
// initialize()
|
||||
// Constructor runs on completion of the DOM loading. Calls updateImageList and then
|
||||
// the function inserts html at the bottom of the page which is used to display the shadow
|
||||
// overlay and the image container.
|
||||
//
|
||||
initialize: function() {
|
||||
|
||||
this.updateImageList();
|
||||
|
||||
this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
|
||||
|
||||
if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
|
||||
if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
|
||||
|
||||
this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
|
||||
this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
|
||||
|
||||
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
|
||||
// If animations are turned off, it will be hidden as to prevent a flicker of a
|
||||
// white 250 by 250 box.
|
||||
var size = (LightboxOptions.animate ? 250 : 1) + 'px';
|
||||
|
||||
|
||||
// Code inserts html at the bottom of the page that looks similar to this:
|
||||
//
|
||||
// <div id="overlay"></div>
|
||||
// <div id="lightbox">
|
||||
// <div id="outerImageContainer">
|
||||
// <div id="imageContainer">
|
||||
// <img id="lightboxImage">
|
||||
// <div style="" id="hoverNav">
|
||||
// <a href="#" id="prevLink"></a>
|
||||
// <a href="#" id="nextLink"></a>
|
||||
// </div>
|
||||
// <div id="loading">
|
||||
// <a href="#" id="loadingLink">
|
||||
// <img src="images/loading.gif">
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div id="imageDataContainer">
|
||||
// <div id="imageData">
|
||||
// <div id="imageDetails">
|
||||
// <span id="caption"></span>
|
||||
// <span id="numberDisplay"></span>
|
||||
// </div>
|
||||
// <div id="bottomNav">
|
||||
// <a href="#" id="bottomNavClose">
|
||||
// <img src="images/close.gif">
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
|
||||
var objBody = $$('body')[0];
|
||||
|
||||
objBody.appendChild(Builder.node('div',{id:'overlay'}));
|
||||
|
||||
objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
|
||||
Builder.node('div',{id:'outerImageContainer'},
|
||||
Builder.node('div',{id:'imageContainer'}, [
|
||||
Builder.node('img',{id:'lightboxImage'}),
|
||||
Builder.node('div',{id:'hoverNav'}, [
|
||||
Builder.node('a',{id:'prevLink', href: '#' }),
|
||||
Builder.node('a',{id:'nextLink', href: '#' })
|
||||
]),
|
||||
Builder.node('div',{id:'loading'},
|
||||
Builder.node('a',{id:'loadingLink', href: '#' },
|
||||
Builder.node('img', {src: LightboxOptions.fileLoadingImage})
|
||||
)
|
||||
)
|
||||
])
|
||||
),
|
||||
Builder.node('div', {id:'imageDataContainer'},
|
||||
Builder.node('div',{id:'imageData'}, [
|
||||
Builder.node('div',{id:'imageDetails'}, [
|
||||
Builder.node('span',{id:'caption'}),
|
||||
Builder.node('span',{id:'numberDisplay'})
|
||||
]),
|
||||
Builder.node('div',{id:'bottomNav'},
|
||||
Builder.node('a',{id:'bottomNavClose', href: '#' },
|
||||
Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
|
||||
)
|
||||
)
|
||||
])
|
||||
)
|
||||
]));
|
||||
|
||||
|
||||
$('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
|
||||
$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
|
||||
$('outerImageContainer').setStyle({ width: size, height: size });
|
||||
$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
|
||||
$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
|
||||
$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
||||
$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
||||
|
||||
var th = this;
|
||||
(function(){
|
||||
var ids =
|
||||
'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
|
||||
'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
|
||||
$w(ids).each(function(id){ th[id] = $(id); });
|
||||
}).defer();
|
||||
},
|
||||
|
||||
//
|
||||
// updateImageList()
|
||||
// Loops through anchor tags looking for 'lightbox' references and applies onclick
|
||||
// events to appropriate links. You can rerun after dynamically adding images w/ajax.
|
||||
//
|
||||
updateImageList: function() {
|
||||
this.updateImageList = Prototype.emptyFunction;
|
||||
|
||||
document.observe('click', (function(event){
|
||||
var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
|
||||
if (target) {
|
||||
event.stop();
|
||||
this.start(target);
|
||||
}
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
//
|
||||
// start()
|
||||
// Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
|
||||
//
|
||||
start: function(imageLink) {
|
||||
|
||||
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
|
||||
|
||||
// stretch overlay to fill page and fade in
|
||||
var arrayPageSize = this.getPageSize();
|
||||
$('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
|
||||
|
||||
new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
|
||||
|
||||
this.imageArray = [];
|
||||
var imageNum = 0;
|
||||
|
||||
if ((imageLink.rel == 'lightbox')){
|
||||
// if image is NOT part of a set, add single image to imageArray
|
||||
this.imageArray.push([imageLink.href, imageLink.title]);
|
||||
} else {
|
||||
// if image is part of a set..
|
||||
this.imageArray =
|
||||
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
|
||||
collect(function(anchor){ return [anchor.href, anchor.title]; }).
|
||||
uniq();
|
||||
|
||||
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
|
||||
}
|
||||
|
||||
// calculate top and left offset for the lightbox
|
||||
var arrayPageScroll = document.viewport.getScrollOffsets();
|
||||
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
|
||||
var lightboxLeft = arrayPageScroll[0];
|
||||
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
|
||||
|
||||
this.changeImage(imageNum);
|
||||
},
|
||||
|
||||
//
|
||||
// changeImage()
|
||||
// Hide most elements and preload image in preparation for resizing image container.
|
||||
//
|
||||
changeImage: function(imageNum) {
|
||||
|
||||
this.activeImage = imageNum; // update global var
|
||||
|
||||
// hide elements during transition
|
||||
if (LightboxOptions.animate) this.loading.show();
|
||||
this.lightboxImage.hide();
|
||||
this.hoverNav.hide();
|
||||
this.prevLink.hide();
|
||||
this.nextLink.hide();
|
||||
// HACK: Opera9 does not currently support scriptaculous opacity and appear fx
|
||||
this.imageDataContainer.setStyle({opacity: .0001});
|
||||
this.numberDisplay.hide();
|
||||
|
||||
var imgPreloader = new Image();
|
||||
|
||||
// once image is preloaded, resize image container
|
||||
|
||||
|
||||
imgPreloader.onload = (function(){
|
||||
this.lightboxImage.src = this.imageArray[this.activeImage][0];
|
||||
this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
|
||||
}).bind(this);
|
||||
imgPreloader.src = this.imageArray[this.activeImage][0];
|
||||
},
|
||||
|
||||
//
|
||||
// resizeImageContainer()
|
||||
//
|
||||
resizeImageContainer: function(imgWidth, imgHeight) {
|
||||
|
||||
// get current width and height
|
||||
var widthCurrent = this.outerImageContainer.getWidth();
|
||||
var heightCurrent = this.outerImageContainer.getHeight();
|
||||
|
||||
// get new width and height
|
||||
var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
|
||||
var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
|
||||
|
||||
// scalars based on change from old to new
|
||||
var xScale = (widthNew / widthCurrent) * 100;
|
||||
var yScale = (heightNew / heightCurrent) * 100;
|
||||
|
||||
// calculate size difference between new and old image, and resize if necessary
|
||||
var wDiff = widthCurrent - widthNew;
|
||||
var hDiff = heightCurrent - heightNew;
|
||||
|
||||
if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
|
||||
if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
|
||||
|
||||
// if new and old image are same size and no scaling transition is necessary,
|
||||
// do a quick pause to prevent image flicker.
|
||||
var timeout = 0;
|
||||
if ((hDiff == 0) && (wDiff == 0)){
|
||||
timeout = 100;
|
||||
if (Prototype.Browser.IE) timeout = 250;
|
||||
}
|
||||
|
||||
(function(){
|
||||
this.prevLink.setStyle({ height: imgHeight + 'px' });
|
||||
this.nextLink.setStyle({ height: imgHeight + 'px' });
|
||||
this.imageDataContainer.setStyle({ width: widthNew + 'px' });
|
||||
|
||||
this.showImage();
|
||||
}).bind(this).delay(timeout / 1000);
|
||||
},
|
||||
|
||||
//
|
||||
// showImage()
|
||||
// Display image and begin preloading neighbors.
|
||||
//
|
||||
showImage: function(){
|
||||
this.loading.hide();
|
||||
new Effect.Appear(this.lightboxImage, {
|
||||
duration: this.resizeDuration,
|
||||
queue: 'end',
|
||||
afterFinish: (function(){ this.updateDetails(); }).bind(this)
|
||||
});
|
||||
this.preloadNeighborImages();
|
||||
},
|
||||
|
||||
//
|
||||
// updateDetails()
|
||||
// Display caption, image number, and bottom nav.
|
||||
//
|
||||
updateDetails: function() {
|
||||
|
||||
// if caption is not null
|
||||
if (this.imageArray[this.activeImage][1] != ""){
|
||||
this.caption.update(this.imageArray[this.activeImage][1]).show();
|
||||
}
|
||||
|
||||
// if image is part of set display 'Image x of x'
|
||||
if (this.imageArray.length > 1){
|
||||
this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
|
||||
}
|
||||
|
||||
new Effect.Parallel(
|
||||
[
|
||||
new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
|
||||
new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
|
||||
],
|
||||
{
|
||||
duration: this.resizeDuration,
|
||||
afterFinish: (function() {
|
||||
// update overlay size and update nav
|
||||
var arrayPageSize = this.getPageSize();
|
||||
this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
|
||||
this.updateNav();
|
||||
}).bind(this)
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
//
|
||||
// updateNav()
|
||||
// Display appropriate previous and next hover navigation.
|
||||
//
|
||||
updateNav: function() {
|
||||
|
||||
this.hoverNav.show();
|
||||
|
||||
// if not first image in set, display prev image button
|
||||
if (this.activeImage > 0) this.prevLink.show();
|
||||
|
||||
// if not last image in set, display next image button
|
||||
if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
|
||||
|
||||
this.enableKeyboardNav();
|
||||
},
|
||||
|
||||
//
|
||||
// enableKeyboardNav()
|
||||
//
|
||||
enableKeyboardNav: function() {
|
||||
document.observe('keydown', this.keyboardAction);
|
||||
},
|
||||
|
||||
//
|
||||
// disableKeyboardNav()
|
||||
//
|
||||
disableKeyboardNav: function() {
|
||||
document.stopObserving('keydown', this.keyboardAction);
|
||||
},
|
||||
|
||||
//
|
||||
// keyboardAction()
|
||||
//
|
||||
keyboardAction: function(event) {
|
||||
var keycode = event.keyCode;
|
||||
|
||||
var escapeKey;
|
||||
if (event.DOM_VK_ESCAPE) { // mozilla
|
||||
escapeKey = event.DOM_VK_ESCAPE;
|
||||
} else { // ie
|
||||
escapeKey = 27;
|
||||
}
|
||||
|
||||
var key = String.fromCharCode(keycode).toLowerCase();
|
||||
|
||||
if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
|
||||
this.end();
|
||||
} else if ((key == 'p') || (keycode == 37)){ // display previous image
|
||||
if (this.activeImage != 0){
|
||||
this.disableKeyboardNav();
|
||||
this.changeImage(this.activeImage - 1);
|
||||
}
|
||||
} else if ((key == 'n') || (keycode == 39)){ // display next image
|
||||
if (this.activeImage != (this.imageArray.length - 1)){
|
||||
this.disableKeyboardNav();
|
||||
this.changeImage(this.activeImage + 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// preloadNeighborImages()
|
||||
// Preload previous and next images.
|
||||
//
|
||||
preloadNeighborImages: function(){
|
||||
var preloadNextImage, preloadPrevImage;
|
||||
if (this.imageArray.length > this.activeImage + 1){
|
||||
preloadNextImage = new Image();
|
||||
preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
|
||||
}
|
||||
if (this.activeImage > 0){
|
||||
preloadPrevImage = new Image();
|
||||
preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//
|
||||
// end()
|
||||
//
|
||||
end: function() {
|
||||
this.disableKeyboardNav();
|
||||
this.lightbox.hide();
|
||||
new Effect.Fade(this.overlay, { duration: this.overlayDuration });
|
||||
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
|
||||
},
|
||||
|
||||
//
|
||||
// getPageSize()
|
||||
//
|
||||
getPageSize: function() {
|
||||
|
||||
var xScroll, yScroll;
|
||||
|
||||
if (window.innerHeight && window.scrollMaxY) {
|
||||
xScroll = window.innerWidth + window.scrollMaxX;
|
||||
yScroll = window.innerHeight + window.scrollMaxY;
|
||||
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
|
||||
xScroll = document.body.scrollWidth;
|
||||
yScroll = document.body.scrollHeight;
|
||||
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
|
||||
xScroll = document.body.offsetWidth;
|
||||
yScroll = document.body.offsetHeight;
|
||||
}
|
||||
|
||||
var windowWidth, windowHeight;
|
||||
|
||||
if (self.innerHeight) { // all except Explorer
|
||||
if(document.documentElement.clientWidth){
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
} else {
|
||||
windowWidth = self.innerWidth;
|
||||
}
|
||||
windowHeight = self.innerHeight;
|
||||
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
windowHeight = document.documentElement.clientHeight;
|
||||
} else if (document.body) { // other Explorers
|
||||
windowWidth = document.body.clientWidth;
|
||||
windowHeight = document.body.clientHeight;
|
||||
}
|
||||
|
||||
// for small pages with total height less then height of the viewport
|
||||
if(yScroll < windowHeight){
|
||||
pageHeight = windowHeight;
|
||||
} else {
|
||||
pageHeight = yScroll;
|
||||
}
|
||||
|
||||
// for small pages with total width less then width of the viewport
|
||||
if(xScroll < windowWidth){
|
||||
pageWidth = xScroll;
|
||||
} else {
|
||||
pageWidth = windowWidth;
|
||||
}
|
||||
|
||||
return [pageWidth,pageHeight];
|
||||
}
|
||||
}
|
||||
|
||||
document.observe('dom:loaded', function () { new Lightbox(); });
|
||||
4221
js/prototype.js
vendored
Normal file
4221
js/prototype.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
58
js/scriptaculous.js
Normal file
58
js/scriptaculous.js
Normal file
@ -0,0 +1,58 @@
|
||||
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
|
||||
|
||||
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||||
|
||||
var Scriptaculous = {
|
||||
Version: '1.8.1',
|
||||
require: function(libraryName) {
|
||||
// inserting via DOM fails in Safari 2.0, so brute force approach
|
||||
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
|
||||
},
|
||||
REQUIRED_PROTOTYPE: '1.6.0',
|
||||
load: function() {
|
||||
function convertVersionString(versionString){
|
||||
var r = versionString.split('.');
|
||||
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
|
||||
}
|
||||
|
||||
if((typeof Prototype=='undefined') ||
|
||||
(typeof Element == 'undefined') ||
|
||||
(typeof Element.Methods=='undefined') ||
|
||||
(convertVersionString(Prototype.Version) <
|
||||
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
|
||||
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
|
||||
Scriptaculous.REQUIRED_PROTOTYPE);
|
||||
|
||||
$A(document.getElementsByTagName("script")).findAll( function(s) {
|
||||
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
|
||||
}).each( function(s) {
|
||||
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
|
||||
var includes = s.src.match(/\?.*load=([a-z,]*)/);
|
||||
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
|
||||
function(include) { Scriptaculous.require(path+include+'.js') });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Scriptaculous.load();
|
||||
205
kalendarz.js
Normal file
205
kalendarz.js
Normal file
@ -0,0 +1,205 @@
|
||||
<!--
|
||||
/*
|
||||
// Kalendarz
|
||||
// autor:
|
||||
// Andrzej Cie¶lak (andrzej.cieslak@gazeta.pl)
|
||||
//
|
||||
// dzia³a pod:
|
||||
// IE >4, Netscape >4, Opera, nie uda³o siê na razie odpaliæ pod Netscape4.x
|
||||
//
|
||||
// opis:
|
||||
// Po klikniêciu na pole tekstowe pojawia siê kalendarz pod
|
||||
// kursorem myszy. Po wybraniu roku, miesi±ca i klikniêciu na
|
||||
// numerze dnia wybrana data jest wstawiana do pola
|
||||
//
|
||||
// historia:
|
||||
// potrzebowa³em wstawiæ datê do formularza w okre¶lonym formacie,
|
||||
// widzia³em skrypt na necie który pozwala³ wybraæ datê z kalendarza,
|
||||
// ale by³ du¿y i skomplikowany, wiêc napisa³em swój
|
||||
//
|
||||
// wywo³anie:
|
||||
// umie¶ciæ w zanczniku body: onLoad="document.onmousemove = mysz;"
|
||||
// lub w tre¶ci strony w znacznikach javascriptu: document.onmousemove = mysz;
|
||||
// zdarzenie pola txt, do którego chcemy wstawiæ datê: onclick="showKal(this)"
|
||||
*/
|
||||
|
||||
var ie4, ns4, ns6;
|
||||
ie = document.all;
|
||||
ns4 = document.layers;
|
||||
ns6 = document.getElementById && !document.all;
|
||||
|
||||
var data = new Date();
|
||||
var amies = data.getMonth();
|
||||
var arok = data.getFullYear();
|
||||
var adzien = data.getDate();
|
||||
var adzientyg = data.getDay();
|
||||
var frmpole;
|
||||
|
||||
// ilo¶æ dni w roku
|
||||
var dni = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
|
||||
// nazwy miesiêcy
|
||||
var miesiac = new Array('Styczeñ','Luty','Marzec','Kwiecieñ', 'Maj','Czerwiec','Lipiec','Sierpieñ','Wrzesieñ','Pa¼dziernik','Listopad','Grudzieñ');
|
||||
|
||||
// dane kolorów
|
||||
var kol = new Array(5)
|
||||
kol[0] = '#FFFFFF'; // kolor t³a kalendarza, kolor tekstu wybranego dnia, nazw dni tyg...
|
||||
kol[1] = 'FBFCFD'; // kolor pól kalendarza - dni zwyk³e
|
||||
kol[2] = 'b8b7b7'; // kolor pól kalendarza - niedziele
|
||||
kol[3] = '#696969'; // kolor pola oznaczaj±cego aktualny dzieñ, kolor ramki, przycisku zamykajacego, tekstu
|
||||
kol[4] = '#696969'; // kolor pól okreslajacych dni tygodnia (pn,wt...)
|
||||
|
||||
// ile lat pokazywane w kalendarzu od aktualnej daty
|
||||
var wstecz = 8;
|
||||
var wprzod = 2;
|
||||
|
||||
// ilo¶æ dni w Lutym - przeliczane po zmianie miesi±ca lub roku
|
||||
function dniMies()
|
||||
{
|
||||
dni[1] = (rok % 4 == 0) ? 29 : 28;
|
||||
}
|
||||
|
||||
// pobieranie pozycji myszy
|
||||
function mysz(e)
|
||||
{
|
||||
if(ns4 || ns6)
|
||||
{
|
||||
x = e.pageX;
|
||||
y = e.pageY;
|
||||
}
|
||||
if(ie)
|
||||
{
|
||||
x = document.body.scrollLeft+event.clientX;
|
||||
y = document.body.scrollTop+event.clientY;
|
||||
}
|
||||
}
|
||||
|
||||
// funkcja pokazujaca kalendarz pod kursorem myszy
|
||||
function showKal(fp)
|
||||
{
|
||||
data = new Date(arok, amies, 1);
|
||||
mies = data.getMonth();
|
||||
rok = data.getFullYear();
|
||||
dzien = data.getDate();
|
||||
dzientyg = data.getDay();
|
||||
|
||||
dniMies();
|
||||
|
||||
frmpole = fp;
|
||||
pozx = x;
|
||||
pozy = y;
|
||||
|
||||
rysujKal();
|
||||
|
||||
if(ns6 || ie)
|
||||
{
|
||||
document.getElementById('kalendarz').style.left = pozx+'px';
|
||||
document.getElementById('kalendarz').style.top = (pozy+10)+'px';
|
||||
document.getElementById('kalendarz').style.visibility = 'visible';
|
||||
}
|
||||
}
|
||||
|
||||
// funkcja ukrywajaca kalendarz i wstawiajaca wybran± datê do pola formularza
|
||||
function hideKal()
|
||||
{
|
||||
if(ns6 || ie)
|
||||
document.getElementById('kalendarz').style.visibility = 'hidden';
|
||||
|
||||
// tutaj ustawia siê format daty
|
||||
// np:
|
||||
// format = selectday + ' ' + miesiac[mies] + ' ' + rok;
|
||||
|
||||
// inny format daty - z zerami poprzedzaj±cymi
|
||||
mies++;
|
||||
if(mies < 10)
|
||||
mies = '0' + mies;
|
||||
if(selectday < 10)
|
||||
selectday = '0' + selectday;
|
||||
|
||||
format = rok+'-'+mies+'-'+selectday
|
||||
|
||||
frmpole.value = format;
|
||||
}
|
||||
|
||||
// ukrywanie kalendarza bez wstawiania daty
|
||||
function exitKal()
|
||||
{
|
||||
if(ns6 || ie)
|
||||
document.getElementById('kalendarz').style.visibility = 'hidden';
|
||||
}
|
||||
|
||||
// ustawianie nowej daty po zmianie miesiaca lub roku
|
||||
function setData()
|
||||
{
|
||||
mies = document.forms['sdata'].elements['month'].value;
|
||||
rok = document.forms['sdata'].elements['year'].value;
|
||||
|
||||
data = new Date(rok, mies, 1);
|
||||
mies = data.getMonth();
|
||||
rok = data.getFullYear();
|
||||
dzien = data.getDate();
|
||||
dzientyg = data.getDay();
|
||||
dniMies();
|
||||
rysujKal();
|
||||
}
|
||||
|
||||
// rysowanie kalendarza
|
||||
function rysujKal()
|
||||
{
|
||||
kaltxt = '<form name="sdata" onSubmit="return false;">';
|
||||
kaltxt += '<table border=0 cellpadding=0 cellspacing=2 style="border:'+kol[3]+' 2px solid;background-color:'+kol[0]+';">';
|
||||
kaltxt += '<tr class=dzien><td colspan=6 height=25><select name="month" class="lista" onChange="setData()">';
|
||||
for(i=0;i<12;i++)
|
||||
{
|
||||
if(i==mies)
|
||||
kaltxt += '<option value="'+i+'" selected>'+miesiac[i]+'</option>';
|
||||
else
|
||||
kaltxt += '<option value="'+i+'">'+miesiac[i]+'</option>';
|
||||
}
|
||||
kaltxt += '</select> <select name="year" class="lista" onChange="setData()">';
|
||||
for(i=(rok-wstecz);i<=(rok+wprzod);i++)
|
||||
{
|
||||
if(i==rok)
|
||||
kaltxt += '<option value="'+i+'" selected>'+i+'</option>';
|
||||
else
|
||||
kaltxt += '<option value="'+i+'">'+i+'</option>';
|
||||
}
|
||||
kaltxt += '</select>';
|
||||
kaltxt += '</td><td><a href="javascript:exitKal()"><span class="aktday"> X </span></a></td></tr>';
|
||||
kaltxt += '<tr class=dnityg><td width=30>Nd</td><td width=30>Pn</td><td width=30>Wt</td><td width=30>¦r</td>';
|
||||
kaltxt += '<td width=30>Czw</td><td width=30>Pt</td><td width=30>So</td></tr><tr class=dzien>';
|
||||
|
||||
j = 1;
|
||||
|
||||
for(i=0;i<dzientyg+dni[mies];i++)
|
||||
{
|
||||
if(i>=dzientyg)
|
||||
{
|
||||
if(j==adzien && rok==arok && mies==amies)
|
||||
kaltxt += '<td class=aktday><a class=aktday href="javascript:selectday='+j+';hideKal();" >'+j+'</a></td>';
|
||||
else if(i%7==0)
|
||||
kaltxt += '<td class=niedz><a class=niedz href="javascript:selectday='+j+';hideKal();" >'+j+'</a></td>';
|
||||
else
|
||||
kaltxt += '<td><a class=dzien href="javascript:selectday='+j+';hideKal();" >'+j+'</a></td>';
|
||||
j++;
|
||||
if(i%7==6)
|
||||
kaltxt += '</tr><tr class=dzien>';
|
||||
}
|
||||
else
|
||||
kaltxt += '<td></td>';
|
||||
}
|
||||
|
||||
kaltxt += '</tr></table></form>';
|
||||
|
||||
document.getElementById("kalendarz").innerHTML = kaltxt;
|
||||
}
|
||||
|
||||
// style kalendarza i warstwa, na której siê znajduje
|
||||
document.write('<div id="kalendarz" style="visibility:hidden;position:absolute;"></div>');
|
||||
document.write('<style type="text/css">');
|
||||
document.write('.dzien{font-family:Verdana;font-size:11px;color:'+kol[3]+';text-align:center;background-color:'+kol[1]+';text-decoration:none}');
|
||||
document.write('.niedz{font-family:Verdana;font-size:11px;color:'+kol[3]+';text-align:center;background-color:'+kol[2]+';text-decoration:none}');
|
||||
document.write('.aktday{color:'+kol[0]+';font-weight:bold;text-align:center;background-color:'+kol[3]+';text-decoration:none}');
|
||||
document.write('.dnityg{font-family:Verdana;font-size:11px;color:'+kol[0]+';text-align:center;background-color:'+kol[4]+';}');
|
||||
document.write('.lista{font-family:Verdana;font-size:11px;color:'+kol[3]+';}</style>');
|
||||
|
||||
//-->
|
||||
133
kategorie.php
Normal file
133
kategorie.php
Normal file
@ -0,0 +1,133 @@
|
||||
<?
|
||||
if(isset($_GET['kto']))
|
||||
{
|
||||
switch($_GET['kto'])
|
||||
{
|
||||
case "zedytowano":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select nazwa_kat from kategorie_u where nazwa_kat='".$_POST['nazwa_k']."' and id_kat <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['nazwa_k']))==0)
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ nazwê Kategorii!!!</span></center><p>');
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
echo('<p><center><span style="color:#FF0000">Podana Kategoria jest ju¿ za³êta!!!</span></center><p>');
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO `kategorie_u` ( `id_kat` , `nazwa_kat` ) VALUES (NULL,'".$_POST['nazwa_k']."')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update kategorie_u SET nazwa_kat='".$_POST['nazwa_k']."' where id_kat='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<p><center><span style="color:#000000">Kategoria zosta³a zapisana w bazie!!!</span></center><p>');
|
||||
$_POST['nazwa_k'] = '';
|
||||
}
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">Nie mo¿na by³o zapisaæ Kategorii w bazie!!!</span></center><p>');
|
||||
}
|
||||
}
|
||||
BREAK;
|
||||
case "edytuj":
|
||||
if(isset($_GET['id']))
|
||||
form_edytujkategorie($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
case "usun":
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$usun2=mysql_query("select id_kat from firma_u where id_kat='".$_GET['id']."'");
|
||||
$usun3=mysql_query("select id_kat from podkategorie_u where id_kat='".$_GET['id']."'");
|
||||
if((mysql_num_rows($usun2)==0) and (mysql_num_rows($usun3)==0))
|
||||
{
|
||||
$usun=mysql_query("delete from kategorie_u where id_kat='".$_GET['id']."'");
|
||||
echo('<p><center><span style="color:#000000">Kategoria zosta³a usuniêta!!!</span></center><p>');
|
||||
}
|
||||
else
|
||||
//$usun;
|
||||
echo('<p><center><span style="color:#FF0000">Nie mo¿na by³o usunac Kategorii!!!</span></center><p>');
|
||||
}
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
case "podzedytowano":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_podkategoria=mysql_query("select nazwa_podkat from podkategorie_u where nazwa_podkat='".$_POST['nazwa_p']."' and id_pod <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['nazwa_p']))==0)
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ nazwê podkategorii!!!</span></center><p>');
|
||||
else if (mysql_num_rows($pobierz_podkategoria)>0)
|
||||
echo('<p><center><span style="color:#FF0000">Podana podkategoria jest ju¿ zajêta!!!</span></center><p>');
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO `podkategorie_u` ( `id_pod` ,`id_kat`, `nazwa_podkat` ) VALUES (NULL,'".$_POST['id_kat']."','".$_POST['nazwa_p']."')") or die(mysql_error());
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update podkategorie_u SET id_kat='".$_POST['id_kat']."',nazwa_podkat='".$_POST['nazwa_p']."' where id_pod='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<p><center><span style="color:#000000">Podkategoria zosta³a zapisana w bazie!!!</span></center><p>');
|
||||
$_POST['nazwa_p'] = '';
|
||||
}
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">Nie mo¿na by³o zapisaæ podkategorii w bazie!!!</span></center><p>');
|
||||
}
|
||||
}
|
||||
BREAK;
|
||||
case "podusun":
|
||||
if(isset($_GET['id']))
|
||||
{
|
||||
$usun4=mysql_query("select id_pod from firma_u where id_pod='".$_GET['id']."'");
|
||||
if(mysql_num_rows($usun4)==0)
|
||||
{
|
||||
$usun=mysql_query("delete from podkategorie_u where id_pod='".$_GET['id']."'");
|
||||
echo('<p><center><span style="color:#000000">Podkategoria zosta³a usuniêta!!!</span></center><p>');
|
||||
}
|
||||
else
|
||||
//$usun;
|
||||
echo('<p><center><span style="color:#FF0000">Nie mo¿na by³o usunac Podkategorii!!!</span></center><p>');
|
||||
}
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
}
|
||||
}
|
||||
if(!isset($_GET['kto']) or ($_GET['kto']!='edytuj'))
|
||||
form_kategorie();
|
||||
$kategorie=mysql_query("select * from kategorie_u order by nazwa_kat asc");
|
||||
if(mysql_num_rows($kategorie)==0)
|
||||
echo('<p><center>W bazie nie ma zadnych kategorii<p></center>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista Kategorii</b></center><br>';
|
||||
echo '<center><table width=35%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa kategorii</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
while($k=mysql_fetch_array($kategorie))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$k['nazwa_kat'].'</td><td width=20% align="center"><a class=link href=?co=kat&kto=edytuj&id='.$k['id_kat'].'>Edytuj</a> | <a class=link href=?co=kat&kto=usun&id='.$k['id_kat'].' onclick="return confirm(\'napewno chcesz usunąć Kategorie?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center>';
|
||||
}
|
||||
if(!isset($_GET['kto']) or ($_GET['kto']!='podedytuj'))
|
||||
form_podkategorie();
|
||||
$podkategorie=mysql_query("select a.id_pod,a.id_kat,a.nazwa_podkat,b.id_kat,b.nazwa_kat from podkategorie_u a,kategorie_u b where a.id_kat=b.id_kat order by nazwa_podkat asc"); // wyswietlanie kategorii
|
||||
if(mysql_num_rows($podkategorie)==0)
|
||||
echo('<p><center>W bazie nie ma zadnych kategorii</center>');
|
||||
else
|
||||
{
|
||||
echo '<center><b><br>Lista Podkategorii</b></center><br>';
|
||||
echo '<center><table width=40%><tr style="background:#E5E5E5" width=40% align=center><td><b>Nazwa Podkategorii</b></td><td><b>Nazwa kategorii</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
$color=$color1;
|
||||
while($k=mysql_fetch_array($podkategorie))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$k['nazwa_podkat'].'</td><td align="left"> '.$k['nazwa_kat'].'</td><td align="center"><a class=link href=?co=kat&kto=podedytuj&id='.$k['id_pod'].'>Edytuj</a> | <a class=link href=?co=kat&kto=podusun&id='.$k['id_pod'].' onclick="return confirm(\'napewno chcesz usunąć Podkategorie?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center>';
|
||||
}
|
||||
?>
|
||||
1177
kilometry.php
Normal file
1177
kilometry.php
Normal file
File diff suppressed because it is too large
Load Diff
862
konta.php
Normal file
862
konta.php
Normal file
@ -0,0 +1,862 @@
|
||||
<?
|
||||
|
||||
$sprawdzanie_uzytkownika=mysql_query("select uprawnienia1 from uzytkownicy where uprawnienia1='0' and id='".$_SESSION['id']."'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($sprawdzanie_uzytkownika)>0)
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(!is_numeric($_SESSION['id']))
|
||||
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if(!isset($_POST['edytuj_uzytkownika']))
|
||||
|
||||
form_edytuj_uzytkownika2($_SESSION['id']);
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['login']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Login!!!</span></center>');
|
||||
|
||||
else if(strlen(trim($_POST['login']))<4)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Login musi zawieraæ min. 5 znaków!!!</span></center>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$pobierz_login=mysql_query("select login from uzytkownicy where login='".$_POST['login']."' and usun='0' and id<>'".$_GET['id']."'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($pobierz_login)>0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Podany Login jest ju¿ zajêty!!!</span></center>');
|
||||
|
||||
}
|
||||
|
||||
if(!sprawdz_email($_POST['mail_uzytkownika']))
|
||||
|
||||
{
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Wprowadzono b³êdny adres mailowy!!!</span></center>');
|
||||
|
||||
$a['email']='';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['imie']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano imienia!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['nazwisko']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano nazwiska
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['ulica']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie wprowadzono ulicy!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['kod']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kodu pocztowego!!!</span></center>');
|
||||
|
||||
else if(!sprawdz_kod($_POST['kod']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Podano kod pocztowy w z³ej formie XX-XXX!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['miasto']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie podano miasta!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['telefon']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano telefonu!!!</span></center>');
|
||||
|
||||
else if(!sprawdz_telefon($_POST['telefon']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Wprowadzono telefon w z³ej formie XXX-XXXXXX!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['haslo1']))>0)
|
||||
|
||||
{
|
||||
|
||||
if($_POST['haslo1']!=$_POST['haslo2'])
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Za drugim razem wprowadzono inne has³o!!!</span></center><p>';
|
||||
|
||||
else
|
||||
|
||||
$zmien_haslo=", haslo='".md5($_POST['haslo1'])."' ";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_edytuj_uzytkownika2($_GET['id']);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$edytuj_uzytkownika=mysql_query("update uzytkownicy SET login='".$_POST['login']."',email='".$_POST['mail_uzytkownika']."',imie='".$_POST['imie']."',nazwisko='".$_POST['nazwisko']."',ulica='".$_POST['ulica']."',telefon='".$_POST['telefon']."',kod='".$_POST['kod']."',miasto='".$_POST['miasto']."' ".$zmien_haslo." where id='".$_GET['id']."'");
|
||||
|
||||
if($edytuj_uzytkownika)
|
||||
|
||||
uwaga('<center><br><b>Zmiany zosta³ wprowadzone</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
} //else
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
echo '<table width="740" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><a class= link href="?co=konta&kto=dodaj">Dodaj U¿ytkownika</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=konta&kto=show">Zarzadzaj U¿ytkownikiem</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=konta&kto=wyjazdy">Blokada wyjazdów</a></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table><p>';
|
||||
|
||||
IF(isset($_GET['akcja']))
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['akcja'])
|
||||
|
||||
{
|
||||
|
||||
case "usun":
|
||||
|
||||
if(!is_numeric($_GET['id']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$usun=mysql_query("update uzytkownicy SET usun='1' where id='".$_GET['id']."'");
|
||||
|
||||
if($usun)
|
||||
|
||||
echo('<center><br><b>U¿ytkownik zosta³ usuniêty</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ U¿ytkownika</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "blok":
|
||||
|
||||
if(!is_numeric($_GET['id']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blok=mysql_query("update uzytkownicy SET blok='TAK' where id='".$_GET['id']."'");
|
||||
|
||||
if($blok)
|
||||
|
||||
echo('<center><br><b>U¿ytkownik zosta³ zablokowany</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mo¿na by³o zablokowaæ U¿ytkownika</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "odblok":
|
||||
|
||||
if(!is_numeric($_GET['id']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$odblok=mysql_query("update uzytkownicy SET blok='NIE' where id='".$_GET['id']."'");
|
||||
|
||||
if($odblok)
|
||||
|
||||
echo('<center><br><b>U¿ytkownik zosta³ odblokowany</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o odblokowaæ U¿ytkownika</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "w_blok":
|
||||
|
||||
if(!is_numeric($_GET['id']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blok=mysql_query("update uzytkownicy SET wyjazd='1' where id='".$_GET['id']."'");
|
||||
|
||||
if($blok)
|
||||
|
||||
echo('<center><br><b>Wyjazdy prywatne zosta³y zablokowane</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o wykonac operacji</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "w_odblok":
|
||||
|
||||
if(!is_numeric($_GET['id']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$odblok=mysql_query("update uzytkownicy SET wyjazd='0' where id='".$_GET['id']."'");
|
||||
|
||||
if($odblok)
|
||||
|
||||
echo('<center><br><b>Wyjazdy prywatne zosta³y odblokowane</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o wykonac operacji</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "pokaz":
|
||||
|
||||
form_poka¿_uzytkownika($_GET['id']);
|
||||
|
||||
BREAK;
|
||||
|
||||
case "edytuj":
|
||||
|
||||
if(!is_numeric($_GET['id']))
|
||||
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if(!isset($_POST['edytuj_uzytkownika']))
|
||||
|
||||
form_edytuj_uzytkownika($_GET['id']);
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['login']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Login!!!</span></center>');
|
||||
|
||||
else if(strlen(trim($_POST['login']))<4)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Login musi zawieraæ min. 5 znaków!!!</span></center>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$pobierz_login=mysql_query("select login from uzytkownicy where usun='0' and login='".$_POST['login']."' and id<>'".$_GET['id']."'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($pobierz_login)>0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Podany Login jest ju¿ zajêty!!!</span></center>');
|
||||
|
||||
}
|
||||
|
||||
if(!sprawdz_email($_POST['mail_uzytkownika']))
|
||||
|
||||
{
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Wprowadzono b³êdny adres mailowy!!!</span></center>');
|
||||
|
||||
$a['email']='';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['imie']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano imienia!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['nazwisko']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano nazwiska
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['ulica']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie wprowadzono ulicy!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['kod']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kodu pocztowego!!!</span></center>');
|
||||
|
||||
else if(!sprawdz_kod($_POST['kod']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Podano kod pocztowy w z³ej formie XX-XXX!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['miasto']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie podano miasta!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['telefon']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano telefonu!!!</span></center>');
|
||||
|
||||
else if(!sprawdz_telefon($_POST['telefon']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Wprowadzono telefon w z³ej formie XXX-XXXXXX!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['haslo1']))>0)
|
||||
|
||||
{
|
||||
|
||||
if($_POST['haslo1']!=$_POST['haslo2'])
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Za drugim razem wprowadzono inne has³o!!!</span></center><p>';
|
||||
|
||||
else
|
||||
|
||||
$zmien_haslo=", haslo='".md5($_POST['haslo1'])."' ";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_edytuj_uzytkownika($_GET['id']);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$uprawnienie=$_POST['uprawnienia1'];
|
||||
|
||||
$uprawnienie2=$_POST['harmonogram'].'-'.$_POST['raporty'].'-'.$_POST['zaliczki'].'-'.$_POST['kilometry'].'-'.$_POST['tankowania'].'-'.$_POST['zestawienia'].'-'.$_POST['samochody'].'-'.$_POST['ustawienia'].'-'.$_POST['konto'];
|
||||
|
||||
|
||||
|
||||
$edytuj_uzytkownika=mysql_query("update uzytkownicy SET login='".$_POST['login']."',email='".$_POST['mail_uzytkownika']."',imie='".$_POST['imie']."',nazwisko='".$_POST['nazwisko']."',ulica='".$_POST['ulica']."' ,id_uzytkownika='".$_POST['id_uzytkownika']."',telefon='".$_POST['telefon']."',kod='".$_POST['kod']."',miasto='".$_POST['miasto']."',uprawnienia1='".$uprawnienie."',uprawnienia2='".$uprawnienie2."' ".$zmien_haslo." where id='".$_GET['id']."'");
|
||||
|
||||
if($edytuj_uzytkownika)
|
||||
|
||||
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
} //else
|
||||
|
||||
BREAK;
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['kto'])
|
||||
|
||||
{
|
||||
|
||||
case "dodaj":
|
||||
|
||||
|
||||
|
||||
if(!isset($_POST['dodaj_uzytkownika']))
|
||||
|
||||
form_dodaj_uzytkownika(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
// sprawdzanie formularza
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['login']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Login!!!</span></center>');
|
||||
|
||||
else if(strlen(trim($_POST['login']))<4)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Login musi zawieraæ min. 5 znaków!!!</span></center>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$pobierz_login=mysql_query("select login from uzytkownicy where usun='0' and login='".$_POST['login']."'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($pobierz_login)>0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Podany Login jest ju¿ zajêty!!!</span></center>');
|
||||
|
||||
}
|
||||
|
||||
if(!sprawdz_email($_POST['mail_uzytkownika']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Wprowadzono b³êdny adres mailowy!!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['imie']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano imienia!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['nazwisko']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano nazwiska
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['ulica']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie wprowadzono ulicy!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['kod']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kodu pocztowego!!!</span></center>');
|
||||
|
||||
else if(!sprawdz_kod($_POST['kod']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Podano kod pocztowy w z³ej formie XX-XXX!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['miasto']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie podano miasta!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
if(strlen(trim($_POST['telefon']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano telefonu!!!</span></center>');
|
||||
|
||||
else if(!sprawdz_telefon($_POST['telefon']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Wprowadzono telefon w z³ej formie XXX-XXXXXX!!!</span></center>');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Stanowisko
|
||||
|
||||
|
||||
|
||||
if(strlen(trim($_POST['haslo1']))==0)
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Nie wprowadzono has³a!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
else if($_POST['haslo1']!=$_POST['haslo2'])
|
||||
|
||||
{
|
||||
|
||||
$blad.='<center><span style="color:#FF0000">Za drugim razem wprowadzi³es inne has³o!!!</span></center>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_dodaj_uzytkownika();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$uprawnienie=$_POST['uprawnienia'];
|
||||
|
||||
$uprawnienie2=$_POST['harmonogram'].'-'.$_POST['raporty'].'-'.$_POST['zaliczki'].'-'.$_POST['kilometry'].'-'.$_POST['tankowania'].'-'.$_POST['zestawienia'].'-'.$_POST['samochody'].'-'.$_POST['ustawienia'].'-'.$_POST['konto'].'-'.$_POST['vending'].'-'.$_POST['magazyn'];
|
||||
|
||||
$dodaj_uzytkownika=mysql_query("insert into uzytkownicy values('','".$_POST['login']."','".$_POST['mail_uzytkownika']."','".$_POST['imie']."','".$_POST['nazwisko']."','".$_POST['stanowisko']."','".$_POST['ulica']."','".$_POST['kod']."','".$_POST['miasto']."','".$_POST['id_inzyniera']."','".$_POST['telefon']."','".md5($_POST['haslo1'])."','".$uprawnienie."','".$uprawnienie2."',now(),'NIE','0','0')");
|
||||
|
||||
if($dodaj_uzytkownika)
|
||||
|
||||
uwaga('<center><br><b>U¿ytkownik zosta³ dodany</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ U¿ytkownika</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case "show":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_userow=mysql_query("select *, date_format(data,'%d.%m%.%Y') data from uzytkownicy where usun='0' and login not like 'Administrator' order by login asc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center>W bazie nie ma ¿adnych u¿ytkowników!!!</center>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
form_szukaj_uzytkownika();
|
||||
|
||||
echo '<center><table width=85%><tr style="background:#E5E5E5" width=70% align=center><td><b>Dane u¿ytkownika</b></td><td><b>Harmonogram</b></td><td><b>Raporty</b></td><td><b>Zaliczki</b></td><td><b>Kilometry</b></td><td><b>Tankowania</b></td><td><b>Zestawienia</b></td><td><b>Samochody</b></td><td><b>Ustawienia</b></td><td><b>Konto</b></td><td><b>Vending</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
// odczyt uprawnien
|
||||
|
||||
$tab=explode('-',$u['uprawnienia2']);
|
||||
|
||||
for($i=0;$i<10;$i++) // tworzenie linków do obrazków
|
||||
|
||||
{
|
||||
|
||||
if($tab[$i]==1)
|
||||
|
||||
$nazwa='tak';
|
||||
|
||||
else
|
||||
|
||||
$nazwa='nie';
|
||||
|
||||
$upr[$i]='<img src=images/'.$nazwa.'.gif>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=konta&akcja=pokaz&id='.$u['id'].'>Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=konta&akcja=edytuj&id='.$u['id'].'>Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=konta&kto=show&akcja=usun&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz usun±æ tego U¿ytkownika\')">Usuñ</a> | ';
|
||||
|
||||
if($u['blok']=='NIE')
|
||||
|
||||
$opcje2.='<a class=link href=?co=konta&kto=show&akcja=blok&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz zablokowaæ tego U¿ytkownika?\')">Blokuj</a>';
|
||||
|
||||
else if($u['blok']=='TAK')
|
||||
|
||||
$opcje2.='<a class=link href=?co=konta&kto=show&akcja=odblok&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz odblokowaæ tego U¿ytkownika?\')">Odblokuj</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['imie'].' '.$u['nazwisko'].'</td><td><center>'.$upr[0].'</center></td><td><center>'.$upr[1].'</center></td><td><center>'.$upr[2].'</center></td><td><center>'.$upr[3].'</center></td><td><center>'.$upr[4].'</center></td><td><center>'.$upr[5].'</center></td><td><center>'.$upr[6].'</center></td><td><center>'.$upr[7].'</center></td><td><center>'.$upr[8].'</center></td><td><center>'.$upr[9].'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "wyjazdy":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_userow=mysql_query("select *, date_format(data,'%d.%m%.%Y') data from uzytkownicy where usun='0' and id_sta='3' and login not like 'Administrator' order by login asc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center>W bazie nie ma ¿adnych u¿ytkowników!!!</center>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><b>Blokada wyjazdów<b></center><br>';
|
||||
|
||||
echo '<center><table width=35%><tr style="background:#E5E5E5" width=70% align=center><td><b>Dane u¿ytkownika</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['wyjazd']=='1')
|
||||
|
||||
$color='red';
|
||||
|
||||
if($u['wyjazd']=='0')
|
||||
|
||||
$opcje2='<a class=link href=?co=konta&kto=wyjazdy&akcja=w_blok&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz zablokowaæ wyjazdy prywatne?\')">Blokuj</a>';
|
||||
|
||||
else if($u['wyjazd']=='1')
|
||||
|
||||
$opcje2='<a class=link href=?co=konta&kto=wyjazdy&akcja=w_odblok&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz odblokowaæ wyjazdy prywatne?\')">Odblokuj</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['imie'].' '.$u['nazwisko'].'</td><td><center>'.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "szukaj":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_userow=mysql_query("select *, date_format(data,'%d.%m%.%Y') data from uzytkownicy where usun='0' and id='".$_POST['id']."' order by login asc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center>W bazie nie ma ¿adnych u¿ytkowników!!!</center>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=85%><tr style="background:#E5E5E5" width=70% align=center><td><b>Dane u¿ytkownika</b></td><td><b>Harmonogram</b></td><td><b>Raporty</b></td><td><b>Zaliczki</b></td><td><b>Kilometry</b></td><td><b>Tankowania</b></td><td><b>Zestawienia</b></td><td><b>Samochody</b></td><td><b>Ustawienia</b></td><td><b>Konto</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
// odczyt uprawnien
|
||||
|
||||
$tab=explode('-',$u['uprawnienia2']);
|
||||
|
||||
for($i=0;$i<9;$i++) // tworzenie linków do obrazków
|
||||
|
||||
{
|
||||
|
||||
if($tab[$i]==1)
|
||||
|
||||
$nazwa='tak';
|
||||
|
||||
else
|
||||
|
||||
$nazwa='nie';
|
||||
|
||||
$upr[$i]='<img src=images/'.$nazwa.'.gif>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=konta&akcja=pokaz&id='.$u['id'].'>Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=konta&akcja=edytuj&id='.$u['id'].'>Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=konta&kto=show&akcja=usun&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz usun±æ tego U¿ytkownika\')">Usuñ</a> | ';
|
||||
|
||||
if($u['blok']=='NIE')
|
||||
|
||||
$opcje2.='<a class=link href=?co=konta&kto=show&akcja=blok&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz zablokowaæ tego U¿ytkownika?\')">Blokuj</a>';
|
||||
|
||||
else if($u['blok']=='TAK')
|
||||
|
||||
$opcje2.='<a class=link href=?co=konta&kto=show&akcja=odblok&id='.$u['id'].' onclick="return confirm(\'Napewno chcesz odblokowaæ tego U¿ytkownika?\')">Odblokuj</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['imie'].' '.$u['nazwisko'].'</td><td><center>'.$upr[0].'</center></td><td><center>'.$upr[1].'</center></td><td><center>'.$upr[2].'</center></td><td><center>'.$upr[3].'</center></td><td><center>'.$upr[4].'</center></td><td><center>'.$upr[5].'</center></td><td><center>'.$upr[6].'</center></td><td><center>'.$upr[7].'</center></td><td><center>'.$upr[8].'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
84
lista_towarow.php
Normal file
84
lista_towarow.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
require ('mpdf.php');
|
||||
require('funkcje.php');
|
||||
lacz_baza();
|
||||
// Zapytanie
|
||||
|
||||
$data = date('d-m-Y H:i:s');
|
||||
$test = '<style type="text/css">
|
||||
<!--
|
||||
.style1 {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.style2 {
|
||||
font-size: 6px;
|
||||
font-weight: bold;
|
||||
}
|
||||
-->
|
||||
</style>
|
||||
<center>
|
||||
<p align="center" class="style1">Lista towarów</p>
|
||||
<table width=100%>
|
||||
<tr align=center>
|
||||
<td bgcolor=#CCCCCC align="center" width=10%>Kod</td>
|
||||
<td bgcolor=#CCCCCC align="center" width=20%>Nazwa</td>
|
||||
<td bgcolor=#CCCCCC align="center" width=20%>Kod EAN</td>
|
||||
<td bgcolor=#CCCCCC align="center" width=35%>Grupa towarowa</td>
|
||||
<td bgcolor=#CCCCCC align="center" width=10>IloϾ</td>
|
||||
</tr>';
|
||||
$towar=mysql_query("select a.id_tow,a.ean,b.jm,a.kod,c.nazwa as nazwa_gru,a.nazwa as nazwa_tow,a.id_jm,a.id_stru,a.opis,a.blok,a.usun,c.poziom,c.id_kategori_wyzej from towar a,jm b,struktura c where a.id_jm=b.id_jm and a.id_stru=c.id_stru and a.usun='0' order by a.kod asc");
|
||||
|
||||
while($t=mysql_fetch_array($towar))
|
||||
{
|
||||
if ($t['poziom']==1)
|
||||
$nazwa_gru = $t['nazwa_gru'];
|
||||
if ($t['poziom']==2)
|
||||
{
|
||||
$poziom_1 = mysql_query("select nazwa from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='1'");
|
||||
$p1=mysql_fetch_array($poziom_1);
|
||||
$nazwa_gru = $p1[0].' - > '.$t['nazwa_gru'];
|
||||
}
|
||||
if ($t['poziom']==3)
|
||||
{
|
||||
$poziom_1 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='2'");
|
||||
$p1=mysql_fetch_array($poziom_1);
|
||||
$poziom_2 = mysql_query("select nazwa,id_stru from struktura where id_stru='".$p1[1]."' and poziom='1'");
|
||||
$p2=mysql_fetch_array($poziom_2);
|
||||
$nazwa_gru = $p2[0].' - > '.$p1[0].' - > '.$t['nazwa_gru'];
|
||||
}
|
||||
if ($t['poziom']==4)
|
||||
{
|
||||
$poziom_1 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='3'");
|
||||
$p1=mysql_fetch_array($poziom_1);
|
||||
$poziom_2 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$p1[1]."' and poziom='2'");
|
||||
$p2=mysql_fetch_array($poziom_2);
|
||||
$poziom_3 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$p2[1]."' and poziom='1'");
|
||||
$p3=mysql_fetch_array($poziom_3);
|
||||
$nazwa_gru = $p3[0].' - > '.$p2[0].' - > '.$p1[0].' - > '.$t['nazwa_gru'];
|
||||
}
|
||||
$test.= '
|
||||
<tr align=center>
|
||||
<td align="center" width=10%>'.$t['kod'].'</td>
|
||||
<td align="left" width=20%>'.$t['nazwa_tow'].'</td>
|
||||
<td align="left" width=20%>'.$t['ean'].'</td>
|
||||
<td align="left" width=35%>'.$nazwa_gru.'</td>
|
||||
<td align="center" width=10%>IloϾ</td>
|
||||
</tr>';
|
||||
}
|
||||
$test.='</table>';
|
||||
// ----------------------
|
||||
|
||||
|
||||
$mpdf = new mPDF();
|
||||
$mpdf=new mPDF('iso-8859-2');
|
||||
$html = $test;
|
||||
$mpdf->charset_in='windows-1250';
|
||||
$mpdf->AddPage('L');
|
||||
$mpdf->SetFooter('MalComm ul.Cieślewskich 25A 03-017 Warszawa||System magazynowy online v 1.0');
|
||||
|
||||
$mpdf->WriteHTML($html,2);
|
||||
$mpdf->Output('lista_towarow_'.$data.'.pdf',D);
|
||||
|
||||
echo $test;
|
||||
?>
|
||||
38
loguj.php
Normal file
38
loguj.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?
|
||||
ob_start();
|
||||
session_start();
|
||||
require('funkcje.php');
|
||||
if(isset($_POST['submit']))
|
||||
{
|
||||
if((sprawdz_dane_do_logowania($_POST['login'])) and (sprawdz_dane_do_logowania($_POST['haslo'])))
|
||||
{
|
||||
$wynik= zaloguj_uzytkownika($_POST['login'],$_POST['haslo']);
|
||||
if($wynik===true)
|
||||
{
|
||||
$_SESSION['login']=$_POST['login'];
|
||||
$uprawnienia=mysql_fetch_array(mysql_query("select uprawnienia2, id from uzytkownicy where login='".$_POST['login']."'"));
|
||||
$_SESSION['uprawnienia']=uprawnienia($uprawnienia['uprawnienia2']);
|
||||
$_SESSION['id']=$uprawnienia['id'];
|
||||
|
||||
header("location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/panel.php");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
meta_tagi('MalComm - System OnLine');
|
||||
form_logowania();
|
||||
ob_end_flush();
|
||||
?>
|
||||
<head>
|
||||
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
|
||||
<script type="text/javascript" src="http://ciasteczka.eu/cookiesEU-latest.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function(){
|
||||
jQuery.fn.cookiesEU({
|
||||
text: 'Ta strona internetowa używa plików cookies w celu poprawienia funkcjonalności. Dzięki nim możemy indywidualnie dostosować stronę do twoich potrzeb. Każdy może zaakceptować pliki cookies albo ma możliwość wyłączenia ich w przeglądarce, dzięki czemu nie będą zbierane żadne informacje.',
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
550
magazyn.php
Normal file
550
magazyn.php
Normal file
@ -0,0 +1,550 @@
|
||||
<?
|
||||
echo '<table width="740" border="0" align="center">
|
||||
<tr>
|
||||
<td><div align="center"><A class=menu3 href="?co=magazyn&kto=towary"><img src="images/towar.png" width="62" height="62" border="0"><BR>Towary</A></div></td>
|
||||
<td><div align="center"><A class=menu3 href="?co=magazyn&kto=dokumenty"><img src="images/dokumenty.png" width="62" height="62" border="0"><BR>Dokumenty</A></div></td>
|
||||
<td><div align="center"><A class=menu3 href="?co=magazyn&kto=remanent"><img src="images/remanent.png" width="62" height="62" border="0"><BR>Remanent</A></div></td>';
|
||||
$upra = mysql_query("select uprawnienia1 from uzytkownicy where id='".$_SESSION['id']."'");
|
||||
$u=mysql_fetch_array($upra);
|
||||
if ($u[0]==1)
|
||||
echo '<td><div align="center"><A class=menu3 href="?co=magazyn&kto=ustawienia"><img src="images/ustawienia.png" width="62" height="62" border="0"><BR>Ustawienia</A></div></td>
|
||||
</tr></table><p>';
|
||||
else
|
||||
echo '</table><p>';
|
||||
switch($_GET['kto'])
|
||||
{
|
||||
case "ustawienia":
|
||||
echo '<table width="740" border="0" align="center">
|
||||
<tr>
|
||||
<td align="left"><div align="left"><A class=menu3 href="?co=magazyn&kto=jm_lista">Definiowanie jednostki</A></div>
|
||||
<div align="left"><A class=menu3 href="?co=magazyn&kto=struktura_lista">Definiowanie grup towarowych</A></div>
|
||||
<div align="left"><A class=menu3 href="?co=magazyn&kto=magazyn_lista">Definiowanie magazyn</A></div></td>
|
||||
</table><p>';
|
||||
break;
|
||||
|
||||
case "usun_jm":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update jm SET usun='1' where id_jm='".$_GET['id']."'");
|
||||
if($usun)
|
||||
{
|
||||
echo('<center><br><b>Jednostka zosta³o usuniête</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun¹æ jednostki</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "edytuj_jm":
|
||||
if(isset($_GET['id']))
|
||||
jednostka_edycja($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
break;
|
||||
case "jm_lista":
|
||||
jednostka();
|
||||
$jm=mysql_query("select id_jm,jm from jm where usun='0' order by jm asc");
|
||||
if(mysql_num_rows($jm)==0)
|
||||
echo('<center><br><b>W bazie nie ma wprowadzonych danych</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista jednostek</b></center><br>';
|
||||
echo '<center><table width=25%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa jednostki</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
while($j=mysql_fetch_array($jm))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$j['jm'].'</td><td width=20% align="center"><a class=link href=?co=magazyn&kto=edytuj_jm&id='.$j['id_jm'].'>Edytuj</a> | <a class=link href=?co=magazyn&kto=usun_jm&id='.$j['id_jm'].' onclick="return confirm(\'Napewno chcesz usunąć pozycje ?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
break;
|
||||
case "dodaj_jm":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select jm from jm where jm='".$_POST['jednostka']."' and usun='0' and id_jm <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['jednostka']))==0)
|
||||
{
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ jednostkê !!!</span></center>');
|
||||
jednostka();
|
||||
}
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
{
|
||||
echo('<p><center><span style="color:#FF0000">Podane jednostka ju¿ istnieje !!!</span></center>');
|
||||
jednostka();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO jm ( `id_jm` , `jm` ) VALUES (NULL,'".$_POST['jednostka']."')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update jm SET jm='".$_POST['jednostka']."' where id_jm='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Jednostka zosta³a dodana</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ jednostki w bazie</b></center><p>');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "magazyn_lista":
|
||||
dodaj_magazyn();
|
||||
$magazyn=mysql_query("select * from magazyn where usun='0' order by nazwa asc");
|
||||
if(mysql_num_rows($magazyn)==0)
|
||||
echo('<center><br><b>W bazie nie ma wprowadzonych danych</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista magazynów</b></center><br>';
|
||||
echo '<center><table width=55%><tr style="background:#E5E5E5" align=center><td width=15%><b>Kod</b></td width=35%><td><b>Nazwa</b></td><td width=22s%><b>Opcje</b></td></tr>';
|
||||
while($m=mysql_fetch_array($magazyn))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
if($m['blok']=='TAK')
|
||||
$color='red';
|
||||
$opcje2='<a class=link href=?co=magazyn&kto=edytuj_magazyn&id='.$m['id_mag'].'>Edytuj</a> | ';
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=usun_magazyn&id='.$m['id_mag'].' onclick="return confirm(\'Napewno chcesz usun±æ ten magazyn ?\')">Usuñ</a> | ';
|
||||
if($m['blok']=='NIE')
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=blok_magazyn&id='.$m['id_mag'].' onclick="return confirm(\'Napewno chcesz zablokowaæ ten magazyn ?\')">Blokuj</a>';
|
||||
else if($m['blok']=='TAK')
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=odblok_magazyn&id='.$m['id_mag'].' onclick="return confirm(\'Napewno chcesz odblokowaæ ten magazyn ?\')">Odblokuj</a>';
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$m['kod'].'</td><td align="left"> '.$m['nazwa'].'</td><td align="center">'.$opcje2.'</td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
break;
|
||||
case "dodaj_magazyn":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select kod from magazyn where kod='".$_POST['kod']."' and usun='0' and id_mag <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['kod']))==0)
|
||||
{
|
||||
$blad=('<p><center><span style="color:#FF0000">Musisz podaæ kod magazynu !!!</span></center>');
|
||||
}
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
{
|
||||
$blad.=('<p><center><span style="color:#FF0000">Podane jednostka ju¿ istnieje !!!</span></center>');
|
||||
}
|
||||
if(strlen(trim($_POST['nazwa']))==0)
|
||||
{
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano nazwy magazynu !!!</span></center>');
|
||||
}
|
||||
if($blad)
|
||||
{
|
||||
uwaga($blad);
|
||||
dodaj_magazyn();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO magazyn ( `id_mag` , `kod`, `nazwa`, `blok`, `usun` ) VALUES (NULL,'".$_POST['kod']."','".$_POST['nazwa']."','NIE','0')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update magazyn SET kod='".$_POST['kod']."',nazwa='".$_POST['nazwa']."' where id_mag='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Magazyn zosta³a dodany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ magazynu w bazie</b></center><p>');
|
||||
$_POST['stanowisko'] = '';
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "usun_magazyn":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update magazyn SET usun='1' where id_mag='".$_GET['id']."'");
|
||||
if($usun)
|
||||
{
|
||||
echo('<center><br><b>Magazyn zosta³o usuniête</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun¹æ magazynu</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "blok_magazyn":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$blok=mysql_query("update magazyn SET blok='TAK' where id_mag='".$_GET['id']."'");
|
||||
if($blok)
|
||||
{
|
||||
echo('<center><br><b>Magazyn zosta³ zablokowany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zablokowaæ magazynu</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "odblok_magazyn":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$blok=mysql_query("update magazyn SET blok='NIE' where id_mag='".$_GET['id']."'");
|
||||
if($blok)
|
||||
{
|
||||
echo('<center><br><b>Magazyn zosta³ odblokowany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zablokowaæ magazynu</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "edytuj_magazyn":
|
||||
if(isset($_GET['id']))
|
||||
magazyn_edycja($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
break;
|
||||
case "struktura_lista":
|
||||
dodaj_strukture();
|
||||
$okreg=mysql_query("select * from struktura where usun='0' and poziom=1 order by nazwa");
|
||||
if(mysql_num_rows($okreg)==0)
|
||||
echo('<center><br><b>W bazie nie ma ¿adnych danych !!!</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista struktura</b></center><br>';
|
||||
echo '<center><table width=90%><tr style="background:#E5E5E5" width=70% align=center><td width=10%><b>ID</b></td><td><b>Nazwa grupy towarowej</b></td><td width=10%><b>Opcje</b></td></tr>';
|
||||
while($s=mysql_fetch_array($okreg))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
if ($s['glowna']==0)
|
||||
{
|
||||
$id_s = '<td align="center"><b>'.$s['id_stru'].'</b></td>';
|
||||
$glowna = '<td align="left"><b> '.$s['nazwa'].'</b</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$id_s = '<td align="center">'.$s['id_stru'].'</td>';
|
||||
$glowna = '<td align="left"> '.$s['nazwa'].'</td>';
|
||||
}
|
||||
echo '<tr align=center style="background:'.$color.'">'.$id_s.''.$glowna.'<td width=20% align="center"><a class=link href=?co=magazyn&kto=edytuj_strukture&id='.$s['id_stru'].'>Edytuj</a> | <a class=link href=?co=magazyn&kto=usun_strukture&id='.$s['id_stru'].' onclick="return confirm(\'Napewno chcesz usunac ten wpis?\')">Usun</a></td></tr>';
|
||||
|
||||
$oddzial=mysql_query("select * from struktura where usun='0' and poziom=2 and id_kategori_wyzej='".$s['id_stru']."' order by nazwa");
|
||||
while($z=mysql_fetch_array($oddzial))
|
||||
{
|
||||
$id_s = '<td align="center">'.$z['id_stru'].'</td>';
|
||||
$glowna = '<td align="left"> '.$s['nazwa'].' -> '.$z['nazwa'].'</td>';
|
||||
echo '<tr align=center style="background:'.$color.'">'.$id_s.''.$glowna.'<td width=20% align="center"><a class=link href=?co=magazyn&kto=edytuj_strukture&id='.$z['id_stru'].'>Edytuj</a> | <a class=link href=?co=magazyn&kto=usun_strukture&id='.$z['id_stru'].' onclick="return confirm(\'Napewno chcesz usunac ten wpis?\')">Usun</a></td></tr>';
|
||||
|
||||
$agencja=mysql_query("select * from struktura where usun='0' and poziom=3 and id_kategori_wyzej='".$z['id_stru']."' order by nazwa");
|
||||
while($x=mysql_fetch_array($agencja))
|
||||
{
|
||||
$id_s = '<td align="center">'.$x['id_stru'].'</td>';
|
||||
$glowna = '<td align="left"> '.$s['nazwa'].' -> '.$z['nazwa'].' - > '.$x['nazwa'].'</td>';
|
||||
echo '<tr align=center style="background:'.$color.'">'.$id_s.''.$glowna.'<td width=20% align="center"><a class=link href=?co=magazyn&kto=edytuj_strukture&id='.$x['id_stru'].'>Edytuj</a> | <a class=link href=?co=magazyn&kto=usun_strukture&id='.$x['id_stru'].' onclick="return confirm(\'Napewno chcesz usunac ten wpis?\')">Usun</a></td></tr>';
|
||||
|
||||
$adres=mysql_query("select * from struktura where usun='0' and poziom=4 and id_kategori_wyzej='".$x['id_stru']."' order by nazwa");
|
||||
while($y=mysql_fetch_array($adres))
|
||||
{
|
||||
$id_s = '<td align="center">'.$y['id_stru'].'</td>';
|
||||
$glowna = '<td align="left"> '.$s['nazwa'].' -> '.$z['nazwa'].' - > '.$x['nazwa'].' - > '.$y['nazwa'].'</td>';
|
||||
echo '<tr align=center style="background:'.$color.'">'.$id_s.''.$glowna.'<td width=20% align="center"><a class=link href=?co=magazyn&kto=edytuj_strukture&id='.$y['id_stru'].'>Edytuj</a> | <a class=link href=?co=magazyn&kto=usun_strukture&id='.$y['id_stru'].' onclick="return confirm(\'Napewno chcesz usunac ten wpis?\')">Usun</a></td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
break;
|
||||
case "dodaj_strukture":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_strukture=mysql_query("select nazwa from struktura where nazwa='".$_POST['nazwa_struktury']."' and usun='0' and id_stru <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['nazwa_struktury']))==0)
|
||||
{
|
||||
echo ('<p><center><span style="color:#FF0000">Musisz podaæ nazwê !!!</span></center><p>');
|
||||
dodaj_strukture();
|
||||
}
|
||||
else if (mysql_num_rows($pobierz_strukture)>0)
|
||||
{
|
||||
echo ('<p><center><span style="color:#FF0000">Podana nazwa juz istnieje !!!</span></center><p>');
|
||||
dodaj_strukture();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if ($_POST['id_struktura']==0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO struktura (`id_stru` ,`nazwa` ,`poziom` ,`id_kategori_wyzej`,`usun`) VALUES (NULL , '".$_POST['nazwa_struktury']."', '1', '0','0');");
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
uwaga('<center><br><b>Grupa towarowa zosta³a dodany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ grupy towarowej</b></center><p>');
|
||||
}
|
||||
else
|
||||
{
|
||||
$a=mysql_fetch_array(mysql_query("select poziom from struktura where id_stru='".$_POST['id_struktura']."'"));
|
||||
if ($a['poziom']==1)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO struktura (`id_stru` ,`nazwa` ,`poziom` ,`id_kategori_wyzej`,`usun`) VALUES (NULL , '".$_POST['nazwa_struktury']."', '2', '".$_POST['id_struktura']."','0');");
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
uwaga('<center><br><b>Grupa towarowa zosta³a dodany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ grupy towarowej</b></center><p>');
|
||||
return;
|
||||
}
|
||||
if ($a['poziom']==2)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO struktura (`id_stru` ,`nazwa` ,`poziom` ,`id_kategori_wyzej`,`usun`) VALUES (NULL , '".$_POST['nazwa_struktury']."', '3', '".$_POST['id_struktura']."','0');");
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
uwaga('<center><br><b>Grupa towarowa zosta³a dodany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ grupy towarowej</b></center><p>');
|
||||
return;
|
||||
}
|
||||
if ($a['poziom']==3)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO struktura (`id_stru` ,`nazwa` ,`poziom` ,`id_kategori_wyzej`,`usun`) VALUES (NULL , '".$_POST['nazwa_struktury']."', '4', '".$_POST['id_struktura']."','0');");
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
uwaga('<center><br><b>Grupa towarowa zosta³a dodany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ grupy towarowej</b></center><p>');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "usun_strukture":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update struktura SET usun='1' where id_stru='".$_GET['id']."'");
|
||||
if($usun)
|
||||
{
|
||||
echo('<center><b>Grupa towarowa zosta³a usuniêty</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
echo('<center><b>Nie mo¿na by³o usun¹æ grupy towarowej</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "edytuj_strukture":
|
||||
if(!isset($_POST['edytuj_strukture']))
|
||||
edytuj_strukture($_GET['id']);
|
||||
break;
|
||||
case "edytuj_strukture2":
|
||||
$pobierz_strukture=mysql_query("select nazwa from struktura where nazwa='".$_POST['nazwa_struktury']."' and usun='0' and id_stru <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['nazwa_struktury']))==0)
|
||||
{
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ nazwê !!!</span></center><p>');
|
||||
edytuj_strukture($_GET['id']);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($blad)
|
||||
{
|
||||
edytuj_strukture($_GET['id']);
|
||||
}
|
||||
$edytuj_strukture=mysql_query("update struktura SET nazwa='".$_POST['nazwa_struktury']."' where id_stru='".$_GET['id']."'");
|
||||
if($edytuj_strukture)
|
||||
{
|
||||
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=ustawienia');
|
||||
}
|
||||
else
|
||||
{
|
||||
uwaga('<center><br><b>Nie mo¿na by³o wprowadziæ zmian</b></center><p>');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "towary":
|
||||
echo '<table width="740" border="0" align="center">
|
||||
<tr>
|
||||
<td align="left"><div align="left"><A class=menu3 href="?co=magazyn&kto=dodaj_towar">Dodaj towar</A></div>
|
||||
<div align="left"><A class=menu3 href="?co=magazyn&kto=lista_towar">Lista towarów</A></div>
|
||||
</table><p>';
|
||||
break;
|
||||
case "dodaj_towar":
|
||||
dodaj_towar();
|
||||
break;
|
||||
case "dodaj_towar_2":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select kod from towar where kod='".$_POST['kod']."' and usun='0' and id_tow <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['kod']))==0)
|
||||
{
|
||||
$blad=('<p><center><span style="color:#FF0000">Musisz podaæ kod towaru !!!</span></center>');
|
||||
}
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
{
|
||||
$blad.=('<p><center><span style="color:#FF0000">Podany kod ju¿ istnieje !!!</span></center>');
|
||||
}
|
||||
if(strlen(trim($_POST['nazwa']))==0)
|
||||
{
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano nazwy towaru !!!</span></center>');
|
||||
}
|
||||
if(($_POST['id_jm'])==0)
|
||||
{
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wybrano jednostki !!!</span></center>');
|
||||
}
|
||||
if(($_POST['id_stru'])==0)
|
||||
{
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wybrano grupy towarowej !!!</span></center>');
|
||||
}
|
||||
if($blad)
|
||||
{
|
||||
uwaga($blad);
|
||||
dodaj_towar();
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO towar ( `id_tow` , `kod`, `nazwa`, `id_jm`, `id_stru`, `opis`,EAN, `blok`, `usun` ) VALUES (NULL,'".$_POST['kod']."','".$_POST['nazwa']."','".$_POST['id_jm']."','".$_POST['id_stru']."','".$_POST['opis']."','".$_POST['ean']."','NIE','0')");
|
||||
else if($_POST['id']>0)
|
||||
$zapis_do_bazy=mysql_query("update towar SET kod='".$_POST['kod']."',nazwa='".$_POST['nazwa']."',ean='".$_POST['ean']."',id_jm='".$_POST['id_jm']."',id_stru='".$_POST['id_stru']."',opis='".$_POST['opis']."' where id_tow='".$_POST['id']."'");
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Towar zosta³ dodany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=towary');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ towaru w bazie</b></center><p>');
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "lista_towar":
|
||||
$towar=mysql_query("select a.id_tow,a.ean,b.jm,a.kod,c.nazwa as nazwa_gru,a.nazwa as nazwa_tow,a.id_jm,a.id_stru,a.opis,a.blok,a.usun,c.poziom,c.id_kategori_wyzej from towar a,jm b,struktura c where a.id_jm=b.id_jm and a.id_stru=c.id_stru and a.usun='0' order by a.kod asc");
|
||||
if(mysql_num_rows($towar)==0)
|
||||
echo('<center><br><b>W bazie nie ma wprowadzonych danych</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista towarów</b></center><br>';
|
||||
echo '<table width=97%><tr align=left><td class="style2"><b><a href="lista_towarow.php" target="_blank">Generuj plik PDF </a></b></tr></td></table>';
|
||||
echo '<center><table width=97%><tr style="background:#E5E5E5" align=center><td><b>Kod</b></td><td width=23%><b>Nazwa</b></td><td width=15%><b>Kod EAN</b></td><td width=30%><b>Grupa towarowa</b></td><td width=7%><b>Ilosc</b></td><td width=33%><b>Opcje</b></td></tr>';
|
||||
while($t=mysql_fetch_array($towar))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
if ($t['poziom']==1)
|
||||
$nazwa_gru = $t['nazwa_gru'];
|
||||
if ($t['poziom']==2)
|
||||
{
|
||||
$poziom_1 = mysql_query("select nazwa from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='1'");
|
||||
$p1=mysql_fetch_array($poziom_1);
|
||||
$nazwa_gru = $p1[0].' - > '.$t['nazwa_gru'];
|
||||
}
|
||||
if ($t['poziom']==3)
|
||||
{
|
||||
$poziom_1 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='2'");
|
||||
$p1=mysql_fetch_array($poziom_1);
|
||||
$poziom_2 = mysql_query("select nazwa,id_stru from struktura where id_stru='".$p1[1]."' and poziom='1'");
|
||||
$p2=mysql_fetch_array($poziom_2);
|
||||
$nazwa_gru = $p2[0].' - > '.$p1[0].' - > '.$t['nazwa_gru'];
|
||||
}
|
||||
if ($t['poziom']==4)
|
||||
{
|
||||
$poziom_1 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$t['id_kategori_wyzej']."' and poziom='3'");
|
||||
$p1=mysql_fetch_array($poziom_1);
|
||||
$poziom_2 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$p1[1]."' and poziom='2'");
|
||||
$p2=mysql_fetch_array($poziom_2);
|
||||
$poziom_3 = mysql_query("select nazwa,id_kategori_wyzej from struktura where id_stru='".$p2[1]."' and poziom='1'");
|
||||
$p3=mysql_fetch_array($poziom_3);
|
||||
$nazwa_gru = $p3[0].' - > '.$p2[0].' - > '.$p1[0].' - > '.$t['nazwa_gru'];
|
||||
}
|
||||
if($t['blok']=='TAK')
|
||||
$color='red';
|
||||
$opcje2='<a class=link href=?co=magazyn&kto=pokaz_towar&id='.$t['id_tow'].'>Poka¿</a> | ';
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=historia_towar&id='.$t['id_tow'].'>Historia</a> | ';
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=zasoby_towar&id='.$t['id_tow'].'>Zasoby</a> | ';
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=edytuj_towar&id='.$t['id_tow'].'>Edytuj</a> | ';
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=usun_towar&id='.$t['id_tow'].' onclick="return confirm(\'Napewno chcesz usun±æ ten towar ?\')">Usuñ</a> | ';
|
||||
if($t['blok']=='NIE')
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=blokuj_towar&id='.$t['id_tow'].' onclick="return confirm(\'Napewno chcesz zablokowaæ ten towar ?\')">Blokuj</a>';
|
||||
else if($t['blok']=='TAK')
|
||||
$opcje2.='<a class=link href=?co=magazyn&kto=odblokuj_towar&id='.$t['id_tow'].' onclick="return confirm(\'Napewno chcesz odblokowaæ ten towar ?\')">Odblokuj</a>';
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$t['kod'].'</td><td align="left"> '.$t['nazwa_tow'].'</td><td align="left"> '.$t['ean'].'</td><td align="left"> '.$nazwa_gru.'</td><td align="center"> 11 '.$t['jm'].'</td><td align="center">'.$opcje2.'</td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
break;
|
||||
case "blokuj_towar":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$blok=mysql_query("update towar SET blok='TAK' where id_tow='".$_GET['id']."'");
|
||||
if($blok)
|
||||
{
|
||||
echo('<center><br><b>Towar zosta³ zablokowany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=towary');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zablokowaæ towaru</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "odblokuj_towar":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$blok=mysql_query("update towar SET blok='NIE' where id_tow='".$_GET['id']."'");
|
||||
if($blok)
|
||||
{
|
||||
echo('<center><br><b>Towar zosta³ odblokowany</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=towary');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zablokowaæ towaru</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "usun_towar":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
// WARUNEK ZASOBY
|
||||
$usun=mysql_query("update towar SET usun='1' where id_tow='".$_GET['id']."'");
|
||||
if($usun)
|
||||
{
|
||||
echo('<center><br><b>Towar zosta³o usuniête</b></center><p>');
|
||||
header('Refresh: 2; url=?co=magazyn&kto=towary');
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun¹æ towaru</b></center><p>');
|
||||
}
|
||||
break;
|
||||
case "zasoby_towar":
|
||||
if(isset($_GET['id']))
|
||||
zasoby_towaru($_GET['id']);
|
||||
break;
|
||||
case "historia_towar":
|
||||
if(isset($_GET['id']))
|
||||
historia_towar($_GET['id']);
|
||||
break;
|
||||
case "edytuj_towar":
|
||||
if(isset($_GET['id']))
|
||||
edytuj_towar($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
break;
|
||||
}
|
||||
?>
|
||||
105
mail_class.php
Normal file
105
mail_class.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?php
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87")
|
||||
or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect)
|
||||
or die ("Nie mozna wybrac nbazy danych");
|
||||
|
||||
$query = "select b.nazwa,a.id_rap,a.nrzlecenia,a.ulica,a.miejscowosc,a.nrseryjny,a.typ,a.data,b.nazwa from raporty a,raporty_pliki b where a.id_rap=b.id_rap and a.wyslano='0' and a.plik='1'";
|
||||
$wynnik = mysql_query($query) or die(mysql_error());
|
||||
|
||||
while($w=mysql_fetch_array($wynnik))
|
||||
{
|
||||
$nrzlecenia = $w[nrzlecenia];
|
||||
$ulica = $w[ulica];
|
||||
$miejscowosc = $w[miejscowosc];
|
||||
$nrseryjny = $w[nrseryjny];
|
||||
$typ = $w[typ];
|
||||
$data = $w[data];
|
||||
$id = $w[id_rap];
|
||||
$plik = $w[nazwa];
|
||||
echo $w[nazwa];
|
||||
|
||||
|
||||
class eMail {
|
||||
var $to;
|
||||
var $subject;
|
||||
var $content;
|
||||
var $headers;
|
||||
var $marker;
|
||||
var $type;
|
||||
var $xMailer = "iGol Mail";
|
||||
|
||||
function eMail($type = "1", $from = "online@malcomm.pl", $replyto = "online@malcomm.pl")
|
||||
{
|
||||
$this->type = $type;
|
||||
$this->headers .= "From: " . $from . "\n";
|
||||
$this->headers .= "Reply-to: " . $replyto . "\n";
|
||||
$this->headers .= "X-Mailer: " . $this->xMailer . "\n";
|
||||
$this->headers .= "MIME-Version: 1.0\n";
|
||||
if ($type == 1) { // text/plain
|
||||
$this->headers .= "Content-Type: text/plain; charset=iso-8859-2\n";
|
||||
} else {
|
||||
srand((double)microtime() * 1000000);
|
||||
$this->marker = md5(uniqid(rand()));
|
||||
$this->headers .= "Content-Type: multipart/mixed;\n";
|
||||
$this->headers .= "\tboundary=\"___" . $this->marker . "==\"\n\n";
|
||||
$this->content = "--___" . $this->marker . "==\n";
|
||||
$this->content .= "Content-Type: text/plain; charset=\"iso-8859-2\"\n";
|
||||
$this->content .= "Content-Transfer-Encoding: 8bit\n\n";
|
||||
}
|
||||
}
|
||||
|
||||
function eMailAttachment($mimeType, $fileName, $data)
|
||||
{
|
||||
if ($this->type != 1) {
|
||||
$this->content .= "\n\n--___" . $this->marker . "==\n";
|
||||
$this->content .= "Content-Type: " . $mimeType . "; name=\"" . $fileName . "\"\n";
|
||||
$this->content .= "Content-Transfer-Encoding: base64\n";
|
||||
$this->content .= "Content-Disposition: attachment; filename=\"" . $fileName . "\"\n\n";
|
||||
$this->content .= chunk_split(base64_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
function eMailSend($to)
|
||||
{
|
||||
if ($this->type != 1) {
|
||||
$this->content .= "--___" . $this->marker . "==--\n\n"; // close marker
|
||||
}
|
||||
mail ($to, $this->subject, $this->content, $this->headers);
|
||||
}
|
||||
|
||||
function eMailContent($subject, $content)
|
||||
{
|
||||
$this->subject = $subject;
|
||||
$this->content .= $content;
|
||||
}
|
||||
}
|
||||
|
||||
$handle = fopen ("logo.jpg", "r");
|
||||
$logo = fread($handle, filesize("logo.jpg"));
|
||||
fclose($handle);
|
||||
|
||||
$tresc = 'Protokó³ wykonania us³ugi:
|
||||
|
||||
Nr Zlecenia : '.$nrzlecenia.'
|
||||
Data : '.$data.'
|
||||
|
||||
Ulica : '.$ulica.'
|
||||
MiejscowoϾ : '.$miejscowosc.'
|
||||
Nr seryjny : '.$nrseryjny.'
|
||||
Typ : '.$typ.'
|
||||
|
||||
WIADOMOŒÆ GENEROWANA AUTOMATYCZNIE - PROSIMY NA NI¡ NIE ODPOWIADAÆ
|
||||
|
||||
System OnLine
|
||||
MalComm
|
||||
';
|
||||
|
||||
$wysylka = new eMail(2); // zwroc uwage na ustawienie typu 2
|
||||
$wysylka->eMailContent('Protokó³ wykonania us³ugi - nr zlecenia '.$nrzlecenia.'', $tresc);
|
||||
//$wysylka->eMailAttachment('text/plain', 'mail.txt', 'ZawartoϾ testowa');
|
||||
$wysylka->eMailAttachment('image/gif', 'protokol.jpg', $logo);
|
||||
$wysylka->eMailSend('jakub.parlinski@malcomm.pl');
|
||||
}
|
||||
|
||||
?>
|
||||
20
mpdf.css
Normal file
20
mpdf.css
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
This is a secondary default stylesheet for mPDF
|
||||
It will only parse element-level CSS here
|
||||
Remove the comment marks below and edit as required
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
These values used to be the default prior to mPDF 4.2
|
||||
Altered to make appearance closer to that of browsers
|
||||
Uncomment these lines to return to behaviour prior to v4.2
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
img { margin: 0.83em 0; vertical-align: bottom; }
|
||||
table { margin: 0.5em; }
|
||||
textarea { vertical-align: top; }
|
||||
*/
|
||||
400
panel.php
Normal file
400
panel.php
Normal file
@ -0,0 +1,400 @@
|
||||
<?
|
||||
|
||||
ob_start();
|
||||
|
||||
session_start();
|
||||
|
||||
require('funkcje.php');
|
||||
|
||||
if(!isset($_SESSION['login']) or !isset($_SESSION['id']) or !isset($_SESSION['uprawnienia']))
|
||||
|
||||
{
|
||||
|
||||
header("location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/loguj.php");
|
||||
|
||||
exit();
|
||||
|
||||
}
|
||||
|
||||
$ok='ok';
|
||||
|
||||
meta_tagi('MalComm - System OnLine');
|
||||
|
||||
lacz_baza();
|
||||
|
||||
strona();
|
||||
|
||||
switch ($_GET['co'])
|
||||
|
||||
{
|
||||
|
||||
case "harmonogram":
|
||||
|
||||
if($_SESSION['uprawnienia']['harmonogram']=='TAK')
|
||||
|
||||
include ("harmonogram.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "raporty":
|
||||
|
||||
if($_SESSION['uprawnienia']['raporty']=='TAK')
|
||||
|
||||
include ("raporty.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "zaliczki":
|
||||
|
||||
if($_SESSION['uprawnienia']['zaliczki']=='TAK')
|
||||
|
||||
include ("zaliczki.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "kilometry":
|
||||
|
||||
if($_SESSION['uprawnienia']['kilometry']=='TAK')
|
||||
|
||||
include ("kilometry.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "tankowania":
|
||||
|
||||
if($_SESSION['uprawnienia']['tankowania']=='TAK')
|
||||
|
||||
include ("tankowania.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "zestawienia":
|
||||
|
||||
if($_SESSION['uprawnienia']['zestawienia']=='TAK')
|
||||
|
||||
include ("zestawienia.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "samochod":
|
||||
|
||||
if($_SESSION['uprawnienia']['samochod']=='TAK')
|
||||
|
||||
include ("samochod.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FFFFFF"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "ustawienia":
|
||||
|
||||
if($_SESSION['uprawnienia']['ustawienia']=='TAK')
|
||||
|
||||
include ("ustawienia.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "konta":
|
||||
|
||||
if($_SESSION['uprawnienia']['konta']=='TAK')
|
||||
|
||||
include ("konta.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
case "vending":
|
||||
|
||||
if($_SESSION['uprawnienia']['vending']=='TAK')
|
||||
|
||||
include ("vending.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "pos":
|
||||
|
||||
if($_SESSION['uprawnienia']['pos']=='TAK')
|
||||
|
||||
include ("pos.php");
|
||||
|
||||
else
|
||||
|
||||
echo '<table width="80%" height="78%" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><span style="color:#FF0000"><span class="style1"> <img src="images/error.jpg" width="128" height="128"><br>
|
||||
|
||||
BRAK DOSTĘPU </span></span></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>';
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "zestawienie_zaliczek":
|
||||
|
||||
include ("zestawienie_zaliczek.php");
|
||||
|
||||
break;
|
||||
|
||||
case "zestawienie_kilometrow":
|
||||
|
||||
include ("zestawienie_klometrow.php");
|
||||
|
||||
break;
|
||||
|
||||
case "zestawienie_paliwo":
|
||||
|
||||
include ("zestawienie_paliwo.php");
|
||||
|
||||
break;
|
||||
|
||||
case "zestawienie_czasu":
|
||||
|
||||
include ("zestawienie_czasu.php");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
default:
|
||||
|
||||
$sprawdzanie_uzytkownika=mysql_query("select uprawnienia1 from uzytkownicy where id_sta='5' and id='".$_SESSION['id']."'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($sprawdzanie_uzytkownika)>0)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
echo '<table width=742 border=0 align="center" cellpadding=0 cellspacing=0>
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr valign=top>
|
||||
|
||||
<td align=middle><p align="left">';
|
||||
|
||||
$sql['host'] = 'sql.atm.home.pl';
|
||||
|
||||
$sql['login'] = 'atm4';
|
||||
|
||||
$sql['password'] = 'alan87';
|
||||
|
||||
$sql['db'] = 'atm4';
|
||||
|
||||
|
||||
|
||||
// polaczenie z baza danych
|
||||
|
||||
mysql_connect($sql['host'],$sql['login'],$sql['password']);
|
||||
|
||||
mysql_select_db($sql['db']);
|
||||
|
||||
|
||||
|
||||
// nazwa tabeli w ktorej znajduja si<73> tematy
|
||||
|
||||
$tab['forum_topics'] = "phpbb_topics";
|
||||
|
||||
|
||||
|
||||
$limit['forum_topics'] = 10; // ilosc wyswietlanych tematow
|
||||
|
||||
$limit['forum_signs'] = 100; // dopuszczalna ilosc liter
|
||||
|
||||
|
||||
|
||||
$path['forum'] = "forum/"; // lokalizacja katalogu z forum
|
||||
|
||||
|
||||
|
||||
// zapytanie do bazy
|
||||
|
||||
$sql_query = "SELECT topic_time,topic_id, topic_title FROM ".$tab['forum_topics']." ORDER BY topic_id ASC LIMIT ".$limit['forum_topics']."" or die ("Nie mozna wykonac zapytania");
|
||||
|
||||
$result = mysql_query($sql_query) or die ("Nie mozna wykonac wyniku");
|
||||
|
||||
|
||||
|
||||
// wyswietlanie rekordow
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
echo '<table width=742 border=0 align="center" cellpadding=0 cellspacing=0>
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr valign=top>
|
||||
|
||||
<td align=middle><p align="left">';
|
||||
|
||||
|
||||
echo '</td>
|
||||
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
<BR> <P style="color:red;">Przy wpisach ulamkowych koniecznie wpisywac '.' (KROPKA). Np 123.45 !!!Nie uzywac przecinkow.!!! </P>
|
||||
</table>';
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
ob_end_flush();
|
||||
|
||||
?>
|
||||
|
||||
50
pdf.php
Normal file
50
pdf.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
define('FPDF_FONTPATH','font/'); //definiuje katalog z czcionkami komponentu
|
||||
require('fpdf.php'); //odniesienie do skryptu komponentu
|
||||
$pdf=new FPDF();
|
||||
$pdf->Open(); //otwiera nowy dokument
|
||||
$pdf->AddPage(); //dodaje nową stronę do dokumentu
|
||||
$pdf->AddFont('arialpl','','arialpl.php'); //dodaje Twoją czcionkę arialpl do dokumentu
|
||||
$pdf->SetFont('arialpl','',20); //ustawia czcionkę arialpl, rozmiar 20
|
||||
$pdf->Text(10,10, 'Witaj świecie. To jest tekst bez zawijania'); //tekst bez zawijania na pozycji x=10, y=10
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$pdf->Multicell(0,4, 'Ten tekst z zamierzenia miał być długi, w każdym razie raczej nie powinien zmieścić się w jednej linijce, ale nie ma żadnego problemu, funkcja Multicell() służy do wprowadzania tekstu z zawijaniem, ba jeśli tekst będzie dłuższy od strony, utworzy ona nową! ',0, 'J',0); //tekst wieloliniowy o szerokości do prawej linii, wysokości linii 4, bez ramki, wyjustowany, bez tła
|
||||
/* Dopisuje niebieski podkreślony odnośnik */
|
||||
$pdf->SetFont('arialpl','',14);
|
||||
$pdf->Write(10,'Zapraszam na ');
|
||||
$pdf->SetTextColor(0,0,255); //zmienia kolor czcionki
|
||||
$pdf->SetFont('','U'); //zmienia styl czcionki na podkreślenie
|
||||
$pdf->Write(10,'4programmers.net','http://4programmers.net');
|
||||
$iks = $pdf->GetX;
|
||||
$igrek = $pdf->GetY;
|
||||
$pdf->Line($iks, $igrek+2,200, $igrek+2); //wstawia linię 2mm pod tekstem, o długości 200mm.
|
||||
/* narysuje granatowy prostokąt z zielonym wypełnieniem */
|
||||
$pdf->SetDrawColor(170,255,64);
|
||||
$pdf->SetFillColor(54,255,102);
|
||||
$pdf->Rect($iks+20, $igrek+20,200,100);
|
||||
$ident = $pdf->AddLink();
|
||||
$pdf->SetLink($ident,0,2); //tworzy (ale nie wstawia do dokumentu!) link do strony 2
|
||||
$tekst = 'Tu znajduje się link do następnej strony!';
|
||||
$dlugosc_tekstu = $pdf->GetStringWidth($tekst); //oblicza długość tekstu
|
||||
$pdf->Text($pdf->GetX(),$pdf->GetY(),$tekst); //wstawia tekst do dokumentu
|
||||
$pdf->Link($pdf->GetX(),$pdf->GetY(),$dlugosc_tekstu,20, $ident); //wstawia pod tekstem link do dokumentu
|
||||
$pdf->AddPage(); //dodaje nową stronę.
|
||||
$pdf->Image('C:\obraz.png', $pdf->GetX()+10, $pdf->GetY()+10, 123, 240, 'PNG');
|
||||
$pdf->SetFont('arialpl','',8);
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
$pdf->Text($pdf->GetX(),$pdf->GetY()+1, 'i to by było na tyle');
|
||||
$pdf->SetCompression(true); //włącza kompresję dokumentu
|
||||
|
||||
/* a poniższe tylko dla ambitnych */
|
||||
$pdf->SetAuthor('Ceer'); //ustawia autora dokumentu
|
||||
$pdf->SetCreator('Dokument generowany przy pomocy skryptu'); //ustawia generator dokumentu
|
||||
$pdf->SetKeywords('słowo_kluczowe1, słowo_kluczowe2'); //ustawia słowa kluczowe dokumentu
|
||||
$pdf->SetSubject('Nauka dynamicznego tworzenia PDFów'); //ustawia temat dokumentu
|
||||
$pdf->SetTitle('Jak łatwo stworzyć PDFa'); //ustawia tytuł dokumentu
|
||||
|
||||
$pdf->SetDisplayMode(100); //domyślne powiększenie dokumentu w przeglądarce
|
||||
$pdf->SetMargins(20, 20 , 20); //ustawia marginesy dla dokumentu
|
||||
|
||||
/* kończy zabawę i generuje dokument */
|
||||
$pdf->Output(); //zamyka i generuje dokument
|
||||
?>
|
||||
1
pos.php
Normal file
1
pos.php
Normal file
@ -0,0 +1 @@
|
||||
<center><b><span style="font-size: small">SIÊ ROBI</span></b></center>
|
||||
66
progbar.css
Normal file
66
progbar.css
Normal file
@ -0,0 +1,66 @@
|
||||
body {
|
||||
margin : 0 auto;
|
||||
width:100%;
|
||||
font-family: "Verdana";
|
||||
color: #40454b;
|
||||
font-size: 12px;
|
||||
text-align:center;
|
||||
}
|
||||
.main {
|
||||
width:540px;
|
||||
margin: 0 auto;
|
||||
text-align:left;
|
||||
}
|
||||
.heading {
|
||||
font-size:14px;
|
||||
font-weight:bold;
|
||||
color:#CC0000;
|
||||
padding:5px;
|
||||
margin-left:10px;
|
||||
border-bottom:solid;
|
||||
border-bottom-width:1px;
|
||||
border-bottom-color:#333333;
|
||||
/* Use this to suppress the horizontal line under the heading */
|
||||
/* border-bottom: 0px solid #000000; */
|
||||
}
|
||||
table {
|
||||
font-family: "Verdana";
|
||||
color: #40454b;
|
||||
font-size: 12px;
|
||||
}
|
||||
.demo {
|
||||
margin : 0 auto;
|
||||
width:100%;
|
||||
margin:20px;
|
||||
/* Use this to suppress all the bars and text */
|
||||
/* display: none; */
|
||||
}
|
||||
td {
|
||||
vertical-align: top;
|
||||
padding: 0 0.5em 0 0;
|
||||
}
|
||||
.code {
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
font-size: 10px;
|
||||
}
|
||||
.code2 {
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
font-size: 11px; font-weight: bold; color: red;
|
||||
}
|
||||
.barheading {
|
||||
color:#006600;
|
||||
font-weight:bold;
|
||||
}
|
||||
.progressBar {
|
||||
border: 1px solid #000000;
|
||||
background-color: #EEEEEE;
|
||||
width: 200px;
|
||||
font-size: 6px;
|
||||
}
|
||||
.innerBar {
|
||||
background-color:#00CC00;
|
||||
width: 0%;
|
||||
}
|
||||
#box3 {
|
||||
font-weight: bold;
|
||||
}
|
||||
3324
raporty.php
Normal file
3324
raporty.php
Normal file
File diff suppressed because it is too large
Load Diff
3246
raporty1.php
Normal file
3246
raporty1.php
Normal file
File diff suppressed because it is too large
Load Diff
461
samochod.old
Normal file
461
samochod.old
Normal file
@ -0,0 +1,461 @@
|
||||
<?
|
||||
echo '<table width="740" border="0" align="center">
|
||||
<tr>
|
||||
<td><div align="center"><a class= link href="?co=samochod&kto=dodaj_samochod">Dodaj Samochód</a></div></td>
|
||||
<td><div align="center"><a class=link href="?co=samochod&kto=show_samochod">Zarzadzaj Samochodami</a></div></td>
|
||||
<td><div align="center"><a class=link href="?co=samochod&kto=dodaj_naprawe">Dodaj naprawe Samochodu</a></div></td>
|
||||
<td><div align="center"><a class=link href="?co=samochod&kto=show_naprawa">Zarzadzaj napraw± Samochodu</a></div></td>
|
||||
</tr>
|
||||
</table><p>';
|
||||
|
||||
|
||||
|
||||
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
||||
{
|
||||
switch($_GET['kto'])
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "edytuj_samochod":
|
||||
if(!is_numeric($_GET['id_sam']))
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
else
|
||||
{
|
||||
if(!isset($_POST['edytuj_samochod']))
|
||||
form_edytuj_samochod($_GET['id_sam']);
|
||||
else
|
||||
{
|
||||
$blad='';
|
||||
if(strlen(trim($_POST['auto']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nazwê auta!!!</span></center>');
|
||||
if(strlen(trim($_POST['nr_rej']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nr rejestracji!!!</span></center>');
|
||||
if(strlen(trim($_POST['rok_auta']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano roku auta!!!</span></center>'); else if (!sprawdz_rok($_POST['rok_auta']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR - rok zakupu!!!</span></center>');
|
||||
if(strlen(trim($_POST['data_zakupu']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty zakupu auta!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['data_zakupu']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data zakupu!!!</span></center>');
|
||||
if(strlen(trim($_POST['ocac']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano OC!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['ocac']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - OC!!!</span></center>'); if(strlen(trim($_POST['ocac2']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano AC!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['ocac2']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - AC!!!</span></center>');
|
||||
if(strlen(trim($_POST['przeglad']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty przegl±du
|
||||
!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['przeglad']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - przegl±d!!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
if($blad)
|
||||
{
|
||||
uwaga($blad);
|
||||
form_edytuj_samochod($_GET['id_sam']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$edytuj_samochod=mysql_query("update samochody SET auto='".$_POST['auto']."',nr_rej='".$_POST['nr_rej']."',rok_auta='".$_POST['rok_auta']."',rok_zakupu='".$_POST['data_zakupu']."',ocac='".$_POST['ocac']."',ocac2='".$_POST['ocac2']."',przeglad='".$_POST['przeglad']."',uwagi='".$_POST['uwagi']."',id='".$_POST['id']."',id_ube='".$_POST['id_ube']."' where id_sam='".$_GET['id_sam']."'");
|
||||
if($edytuj_samochod)
|
||||
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>');
|
||||
else
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
||||
');
|
||||
}
|
||||
}//else
|
||||
} //else
|
||||
BREAK;
|
||||
case "edytuj_naprawe":
|
||||
if(!is_numeric($_GET['id_nap']))
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
else
|
||||
{
|
||||
if(!isset($_POST['edytuj_naprawe']))
|
||||
form_edytuj_naprawe($_GET['id_nap']);
|
||||
else
|
||||
{
|
||||
$blad='';
|
||||
if(strlen(trim($_POST['data_naprawy']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty naprawy!!!</span></center>'); else if (!sprawdz_date($_POST['data_naprawy']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data naprawy!!!</span></center>');
|
||||
if(strlen(trim($_POST['naprawa']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wprowadzono rodzaju naprawy!!!</span></center>');
|
||||
if(strlen(trim($_POST['lokalizacja']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano lokalizacji
|
||||
!!!</span></center>');
|
||||
if(strlen(trim($_POST['koszt']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kosztu!!!</span></center>'); else if (!sprawdz_koszt($_POST['koszt']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma kosztu XX.XX!!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
if($blad)
|
||||
{
|
||||
uwaga($blad);
|
||||
form_edytuj_naprawe($_GET['id_nap']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$edytuj_samochod=mysql_query("update naprawa SET data_naprawy='".$_POST['data_naprawy']."',naprawa='".$_POST['naprawa']."',lokalizacja='".$_POST['lokalizacja']."',koszt='".$_POST['koszt']."',id_sam='".$_POST['id_sam']."' where id_nap='".$_GET['id_nap']."'");
|
||||
$id2 = $_GET['id_nap'];
|
||||
if($edytuj_naprawe)
|
||||
{
|
||||
$p_pojemnosc=$_FILES['plik1']['size'];//pojemnosc pliku
|
||||
$p_typ=$_FILES['plik1']['type']; // typ pliku
|
||||
$p_nazwa=$_FILES['plik1']['name']; // nazwa pliku
|
||||
$p_smiec=$_FILES['plik1']['tmp_name']; // chwilowa nazwa pliku
|
||||
|
||||
$p_roz= array_pop(explode(".", $p_nazwa));
|
||||
|
||||
$max_size=round(($_POST['max_file_size']/1048576),3)."MB";
|
||||
|
||||
$poj_MB=round(($p_pojemnosc/1048576),2).'MB';
|
||||
|
||||
$losowa = rand(1,100000000);
|
||||
$liczba = $losowa + $p_pojemnosc;
|
||||
$p_nazwa_zm=(md5($liczba)).".".$p_roz;
|
||||
$folder="naprawa/";
|
||||
if (($_FILES['plik1']['type']=="image/pjpeg") OR ($_FILES['plik1']['type']=="image/jpeg") OR ($_FILES['plik1']['type']=="application/pdf")){
|
||||
if(@move_uploaded_file($p_smiec, $folder.$p_nazwa_zm)) {
|
||||
echo "<center>Przeslanie pliku powiod³o siê - <b>".$k_nieb.$p_nazwa."</b>"." ".$poj_MB."</center>";
|
||||
$path_file=$folder.$p_nazwa_zm;
|
||||
$zapytanie=mysql_query("insert into naprawa_pliki values('','.$id2.','$path_file')");
|
||||
$zapytanie2=mysql_query("update naprawa SET plik='1' where id_nap='".$id2."'");
|
||||
}
|
||||
else
|
||||
{
|
||||
exit('<center><b>Nie mozna zachowac pliku. Prawdopodobnie nie ma folderu lub plik jest za du¿y - max 250 kB</b></center>');
|
||||
}
|
||||
}
|
||||
|
||||
uwaga('<b><center><p>Zmiany zosta³y wprowadzone</b></center><p>');
|
||||
}
|
||||
else
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
||||
|
||||
|
||||
');
|
||||
}
|
||||
}//else
|
||||
} //else
|
||||
BREAK;
|
||||
case "usun_plik":
|
||||
if(!is_numeric($_GET['id_pn']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun_plik=mysql_query("select nazwa,id_nap from naprawa_pliki where id_pn='".$_GET['id_pn']."'");
|
||||
$n=mysql_fetch_array($usun_plik);
|
||||
$usun=mysql_query("delete from naprawa_pliki where id_pn='".$_GET['id_pn']."'");
|
||||
$zapytanie2=mysql_query("select id_nap from naprawa_pliki where id_nap='".$n[1]."'");
|
||||
$z=mysql_fetch_array($zapytanie2);
|
||||
if ($z[0]==0)
|
||||
{
|
||||
$zapytanie3=mysql_query("update naprawa SET plik='0' where id_nap='".$n[1]."'");
|
||||
}
|
||||
if($usun)
|
||||
{
|
||||
echo('<center><br><b>Plik zosta³o usuniêty</b></center><p>
|
||||
');
|
||||
unlink ($n[0]);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ pliku</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
|
||||
case "usun_samochod":
|
||||
if(!is_numeric($_GET['id_sam']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("delete from samochody where id_sam='".$_GET['id_sam']."'");
|
||||
if($usun)
|
||||
echo('<center><br><b>Samochód zosta³ usuniêty</b></center><p>');
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ Samochodu</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
case "usun_naprawe":
|
||||
if(!is_numeric($_GET['id_nap']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("delete from naprawa where id_nap='".$_GET['id_nap']."'");
|
||||
if($usun)
|
||||
echo('<center><br><b>Naprawa zosta³a usuniêta</b></center><p>');
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ Naprawy</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
case "pokaz_samochod":
|
||||
form_poka¿_samochod($_GET['id_sam']);
|
||||
BREAK;
|
||||
case "pokaz_naprawe":
|
||||
form_poka¿_naprawe($_GET['id_nap']);
|
||||
BREAK;
|
||||
case "dodaj_samochod":
|
||||
|
||||
if(!isset($_POST['dodaj_samochod']))
|
||||
form_dodaj_samochod(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
else
|
||||
{
|
||||
// sprawdzanie formularza
|
||||
$blad='';
|
||||
if(strlen(trim($_POST['auto']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nazwê auta!!!</span></center>');
|
||||
if(strlen(trim($_POST['nr_rej']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nr rejestracji!!!</span></center>');
|
||||
if(strlen(trim($_POST['rok_auta']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano roku auta!!!</span></center>'); else if (!sprawdz_rok($_POST['rok_auta']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR - rok zakupu!!!</span></center>');
|
||||
if(strlen(trim($_POST['data_zakupu']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty zakupu auta!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['data_zakupu']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data zakupu!!!</span></center>');
|
||||
if(strlen(trim($_POST['oc']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano OC!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['oc']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - OC!!!</span></center>'); if(strlen(trim($_POST['ac']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano AC!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['ac']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - AC!!!</span></center>');
|
||||
if(strlen(trim($_POST['przeglad']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty przegl±du
|
||||
!!!</span></center>');
|
||||
else if (!sprawdz_date($_POST['przeglad']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - przegl±d!!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
if($blad)
|
||||
{
|
||||
uwaga($blad);
|
||||
form_dodaj_samochod();
|
||||
}
|
||||
else
|
||||
{
|
||||
$dodaj_samochod=mysql_query("insert into samochody values('','".$_POST['auto']."','".$_POST['nr_rej']."','".$_POST['przypisany']."','".$_POST['rok_auta']."','".$_POST['data_zakupu']."','".$_POST['oc']."','".$_POST['ac']."','".$_POST['ubezpieczenia']."','".$_POST['przeglad']."','".$_POST['uwagi']."','0')");
|
||||
if($dodaj_samochod)
|
||||
uwaga('<center><br><b>Samochod zosta³ dodany</b></center><p>');
|
||||
else
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ Samochodu</b></center><p>
|
||||
');
|
||||
}
|
||||
}//else
|
||||
break;
|
||||
|
||||
|
||||
case "dodaj_naprawe":
|
||||
|
||||
if(!isset($_POST['dodaj_naprawe']))
|
||||
form_dodaj_naprawe(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
else
|
||||
{
|
||||
// sprawdzanie formularza
|
||||
$blad='';
|
||||
if(strlen(trim($_POST['data_naprawy']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty naprawy!!!</span></center>'); else if (!sprawdz_date($_POST['data_naprawy']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data naprawy!!!</span></center>');
|
||||
if(($_POST['id_sam'])==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wybrano samochodu!!!</span></center>');
|
||||
if(strlen(trim($_POST['naprawa']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wprowadzono rodzaju naprawy!!!</span></center>');
|
||||
if(strlen(trim($_POST['lokalizacja']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano lokalizacji
|
||||
!!!</span></center>');
|
||||
if(strlen(trim($_POST['koszt']))==0)
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kosztu!!!</span></center>'); else if (!sprawdz_koszt($_POST['koszt']))
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma kosztu XX.XX!!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
if($blad)
|
||||
{
|
||||
uwaga($blad);
|
||||
form_dodaj_naprawe();
|
||||
}
|
||||
else
|
||||
{
|
||||
$dodaj_samochod=mysql_query("insert into naprawa values('','".$_POST['data_naprawy']."','".$_POST['id_sam']."','".$_POST['naprawa']."','".$_POST['lokalizacja']."','".$_POST['koszt']."','0')");
|
||||
$id2 = mysql_insert_id();
|
||||
if($dodaj_samochod)
|
||||
{
|
||||
$p_pojemnosc=$_FILES['plik1']['size'];//pojemnosc pliku
|
||||
$p_typ=$_FILES['plik1']['type']; // typ pliku
|
||||
$p_nazwa=$_FILES['plik1']['name']; // nazwa pliku
|
||||
$p_smiec=$_FILES['plik1']['tmp_name']; // chwilowa nazwa pliku
|
||||
|
||||
$p_roz= array_pop(explode(".", $p_nazwa));
|
||||
|
||||
$max_size=round(($_POST['max_file_size']/1048576),3)."MB";
|
||||
|
||||
$poj_MB=round(($p_pojemnosc/1048576),2).'MB';
|
||||
$losowa = rand(1,100000000);
|
||||
$liczba = $losowa + $p_pojemnosc;
|
||||
$p_nazwa_zm=(md5($liczba)).".".$p_roz;
|
||||
$folder="naprawa/";
|
||||
if (($_FILES['plik1']['type']=="image/pjpeg") OR ($_FILES['plik1']['type']=="image/jpeg") OR ($_FILES['plik1']['type']=="application/pdf")){
|
||||
if(@move_uploaded_file($p_smiec, $folder.$p_nazwa_zm)) {
|
||||
echo "<center>Przeslanie pliku powiod³o siê - <b>".$k_nieb.$p_nazwa."</b>"." ".$poj_MB."</center>";
|
||||
$path_file=$folder.$p_nazwa_zm;
|
||||
$zapytanie=mysql_query("insert into naprawa_pliki values('','.$id2.','$path_file')");
|
||||
$zapytanie2=mysql_query("update naprawa SET plik='1' where id_nap='".$id2."'");
|
||||
}
|
||||
else
|
||||
{
|
||||
exit('<center><b>Nie mozna zachowac pliku. Prawdopodobnie nie ma folderu lub plik jest za du¿y - max 250 kB</b></center>');
|
||||
}
|
||||
}
|
||||
uwaga('<center><br><b>Naprawa zosta³a dodanana</b></center><p>');
|
||||
|
||||
}
|
||||
else
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ Naprawy</b></center><p>');
|
||||
}
|
||||
}//else
|
||||
break;
|
||||
|
||||
|
||||
|
||||
case "show_samochod":
|
||||
// pobieranie userów
|
||||
$data1=date("Y-m-d",strtotime("-7 days",time()));
|
||||
$pobierz_samochod=mysql_query("select a.id_sam,a.auto,a.nr_rej,b.imie,b.nazwisko,a.rok_auta,a.rok_zakupu,a.ocac,a.ocac2,c.ubezpieczenia,a.przeglad from samochody a,uzytkownicy b,ubezpieczenia c where a.id=b.id and a.id_ube=c.id_ube order by a.auto asc");
|
||||
if(mysql_num_rows($pobierz_samochod)==0)
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wproadzonych samochodów!!!</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=98%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa auta</b></td><td><b>Nr rejest.</b></td><td><b>Przypisany</b></td><td><b>Rok auta</b></td><td><b>Data zakupu</b></td><td><b>OC</b></td><td><b>AC</b></td><td><b>Ubezpieczyciel</b></td><td><b>Przegl±d</b></td><td><b>Stan km</b></td><td><b>Opcje</b></td></tr>';
|
||||
while($u=mysql_fetch_array($pobierz_samochod))
|
||||
{
|
||||
|
||||
$color=zmien_color($color);
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_samochod&id_sam='.$u['id_sam'].' target="_blank">Poka¿</a> | ';
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_samochod&id_sam='.$u['id_sam'].'>Edytuj</a> | ';
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_samochod&id_sam='.$u['id_sam'].' onclick="return confirm(\'Napewno chcesz usun±æ ten Samochód\')">Usuñ</a>';
|
||||
$data2 = $u['przeglad'];
|
||||
if ($data2 <= $data1)
|
||||
{
|
||||
$color='#FCA1A1';
|
||||
}
|
||||
$sql=mysql_query("SELECT kmstop FROM kilometry where id_sam='".$u['id_sam']."' ORDER BY kmstop DESC LIMIT 1");
|
||||
|
||||
while($a=mysql_fetch_array($sql))
|
||||
{
|
||||
$kmstop = $a['kmstop'];
|
||||
}
|
||||
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['auto'].'</td><td><center>'.$u['nr_rej'].'</center></td><td><center>'.$u['imie'].' '.$u['nazwisko'].'</center></td><td><center>'.$u['rok_auta'].'</center></td><td><center>'.$u['rok_zakupu'].'</center></td><td><center>'.$u['ocac'].'</center></td><td><center>'.$u['ocac2'].'</center></td><td><center>'.$u['ubezpieczenia'].'</center></td><td><center>'.$u['przeglad'].'</center></td><td><center>'.$kmstop.' km</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
}
|
||||
BREAK;
|
||||
case "szukaj_samochod":
|
||||
// pobieranie userów
|
||||
$pobierz_samochod=mysql_query("select a.id_sam,a.auto,a.nr_rej,b.imie,b.nazwisko,a.rok_auta,a.rok_zakupu,a.ocac,c.ubezpieczenia,a.przeglad from samochody a,uzytkownicy b,ubezpieczenia c where a.id=b.id and a.id_ube=c.id_ube and a.auto like'%".$_POST['auto']."%' and a.nr_rej like'%".$_POST['nrrej']."%' and a.rok_auta like'%".$_POST['rokauta']."%' and a.id_ube='".$_POST['id_ube']."' order by a.auto asc");
|
||||
if(mysql_num_rows($pobierz_samochod)==0)
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wproadzonych samochodów!!!</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><table width=98%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa auta</b></td><td><b>Nr rejest.</b></td><td><b>Przypisany</b></td><td><b>Rok auta</b></td><td><b>Data zakupu</b></td><td><b>OC/AC</b></td><td><b>Ubezpieczyciel</b></td><td><b>Przegl±d</b></td><td><b>Opcje</b></td></tr>';
|
||||
while($u=mysql_fetch_array($pobierz_samochod))
|
||||
{
|
||||
$sql=mysql_query("SELECT kmstop FROM kilometry where id_sam='".$u['id_sam']."' ORDER BY kmstop DESC LIMIT 1");
|
||||
while($a=mysql_fetch_array($sql))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_samochod&id_sam='.$u['id_sam'].' target="_blank">Poka¿</a> | ';
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_samochod&id_sam='.$u['id_sam'].'>Edytuj</a> | ';
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_samochod&id_sam='.$u['id_sam'].' onclick="return confirm(\'Napewno chcesz usun±æ ten Samochód\')">Usuñ</a>';
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['auto'].'</td><td><center>'.$u['nr_rej'].'</center></td><td><center>'.$u['imie'].' '.$u['nazwisko'].'</center></td><td><center>'.$u['rok_auta'].'</center></td><td><center>'.$u['rok_zakupu'].'</center></td><td><center>'.$u['ocac'].'</center></td><td><center>'.$u['ubezpieczenia'].'</center></td><td><center>'.$a['kmstop'].' km</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
}
|
||||
}
|
||||
echo '</table></center>';
|
||||
}
|
||||
BREAK;
|
||||
case "show_naprawa":
|
||||
// pobieranie userów
|
||||
$pobierz_naprawe=mysql_query("select a.id_nap,a.plik,a.data_naprawy,b.auto,b.nr_rej,a.naprawa,a.lokalizacja,a.koszt from naprawa a,samochody b where a.id_sam=b.id_sam order by a.data_naprawy desc");
|
||||
if(mysql_num_rows($pobierz_naprawe)==0)
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wprowadzonej naprawy!!!</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
form_szukaj_naprawe();
|
||||
$zapytanie=mysql_query("select sum(koszt) as koszt from naprawa");
|
||||
$z= mysql_fetch_array($zapytanie);
|
||||
echo '<center><table width=95%><tr width=70% align=center><td></td></tr>';
|
||||
echo '<br>';
|
||||
echo "Suma kwoty napraw: <b>".$z[koszt]. "</b> PLN<br><br>";
|
||||
echo '</table></center>';
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data naprawy</b></td><td><b>Nazwa auta</b></td><td><b>Rodzaj naprawy</b></td><td><b>Lokalizacja</b></td><td><b>Koszt</b></td><td><b>Pliki</b></td><td><b>Opcje</b></td></tr>';
|
||||
while($u=mysql_fetch_array($pobierz_naprawe))
|
||||
{
|
||||
if(strlen(trim($u['plik'])==1))
|
||||
$plik='<span style="color:#198020">JEST</span>';
|
||||
else
|
||||
$plik='<span style="color:#FF0000">BRAK</span>';
|
||||
$naprawa = str_split($u['naprawa'], 35);
|
||||
$color=zmien_color($color);
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_naprawe&id_nap='.$u['id_nap'].' target="_blank">Poka¿</a> | ';
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_naprawe&id_nap='.$u['id_nap'].'>Edytuj</a> | ';
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_naprawe&id_nap='.$u['id_nap'].' onclick="return confirm(\'Napewno chcesz usun±æ t± Naprawe\')">Usuñ</a>';
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_naprawy'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td>'.$naprawa[0].'...</td><td><center>'.$u['lokalizacja'].'</center></td><td><center>'.$u['koszt'].' PLN</center></td><td><center>'.$plik.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
}
|
||||
echo '</table></center>';
|
||||
}
|
||||
BREAK;
|
||||
case "szukaj_naprawe":
|
||||
// pobieranie userów
|
||||
$pobierz_naprawe=mysql_query("select a.id_nap,a.data_naprawy,a.plik,b.auto,b.nr_rej,a.naprawa,a.lokalizacja,a.koszt from naprawa a,samochody b where a.id_sam=b.id_sam and a.data_naprawy like '%".$_POST['data']."%' and b.nr_rej like '%".$_POST['nr_rej']."%' and a.lokalizacja like '%".$_POST['lokalizacja']."%' order by a.data_naprawy desc");
|
||||
if(mysql_num_rows($pobierz_naprawe)==0)
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wprowadzonej naprawy!!!</b></center><p>
|
||||
');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
$_POST['data']='';
|
||||
$_POST['nr_rej']='';
|
||||
$_POST['lokalizacja']='';
|
||||
form_szukaj_naprawe();
|
||||
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data naprawy</b></td><td><b>Nazwa auta</b></td><td><b>Rodzaj naprawy</b></td><td><b>Lokalizacja</b></td><td><b>Koszt</b></td><td><b>Pliki</b></td><td><b>Opcje</b></td></tr>';
|
||||
while($u=mysql_fetch_array($pobierz_naprawe))
|
||||
{
|
||||
if(strlen(trim($u['plik'])==1))
|
||||
$plik='<span style="color:#198020">JEST</span>';
|
||||
else
|
||||
$plik='<span style="color:#FF0000">BRAK</span>';
|
||||
$naprawa2 = str_split($u['naprawa'], 35);
|
||||
$color=zmien_color($color);
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_naprawe&id_nap='.$u['id_nap'].' target="_blank">Poka¿</a> | ';
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_naprawe&id_nap='.$u['id_nap'].'>Edytuj</a> | ';
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_naprawe&id_nap='.$u['id_nap'].' onclick="return confirm(\'Napewno chcesz usun±æ t± Naprawe\')">Usuñ</a>';
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_naprawy'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td>'.$naprawa2[0].'...</td><td><center>'.$u['lokalizacja'].'</center></td><td><center>'.$u['koszt'].'</center></td><td><center>'.$plik.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
}
|
||||
$zapytanie=mysql_query("select sum(a.koszt) as koszt from naprawa a,samochody b where a.id_sam=b.id_sam and b.nr_rej like '%".$_POST['nr_rej']."%'");
|
||||
$z= mysql_fetch_array($zapytanie);
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=70% align=center><td></td></tr>';
|
||||
echo '<br>';
|
||||
echo "Suma kwoty napraw: <b>".$z[koszt]. "</b> PLN";
|
||||
echo '</table></center>';
|
||||
echo '</table></center>';
|
||||
}
|
||||
BREAK;
|
||||
} //switch
|
||||
} //if
|
||||
|
||||
?>
|
||||
979
samochod.php
Normal file
979
samochod.php
Normal file
@ -0,0 +1,979 @@
|
||||
<?
|
||||
|
||||
echo '<table width="740" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><a class= link href="?co=samochod&kto=dodaj_samochod">Dodaj Samochód</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=samochod&kto=show_samochod">Zarzadzaj Samochodami</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=samochod&kto=dodaj_naprawe">Dodaj naprawe Samochodu</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=samochod&kto=show_naprawa">Zarzadzaj napraw± Samochodu</a></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table><p>';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['kto'])
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "edytuj_samochod":
|
||||
|
||||
if(!is_numeric($_GET['id_sam']))
|
||||
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if(!isset($_POST['edytuj_samochod']))
|
||||
|
||||
form_edytuj_samochod($_GET['id_sam']);
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['auto']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nazwê auta!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['nr_rej']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nr rejestracji!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['rok_auta']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano roku auta!!!</span></center>'); else if (!sprawdz_rok($_POST['rok_auta']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR - rok zakupu!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['data_zakupu']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty zakupu auta!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['data_zakupu']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data zakupu!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['ocac']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano OC!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['ocac']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - OC!!!</span></center>'); if(strlen(trim($_POST['ocac2']))==0)
|
||||
|
||||
|
||||
|
||||
if(strlen(trim($_POST['olej']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma KM!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['przeglad']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty przegl±du
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['przeglad']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - przegl±d!!!</span></center>');
|
||||
|
||||
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_edytuj_samochod($_GET['id_sam']);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$edytuj_samochod=mysql_query("update samochody SET auto='".$_POST['auto']."',nr_rej='".$_POST['nr_rej']."',rok_auta='".$_POST['rok_auta']."',rok_zakupu='".$_POST['data_zakupu']."',ocac='".$_POST['ocac']."',ocac2='".$_POST['olej']."',przeglad='".$_POST['przeglad']."',uwagi='".$_POST['uwagi']."',id='".$_POST['id']."',id_ube='".$_POST['id_ube']."',status='".$_POST['status']."' where id_sam='".$_GET['id_sam']."'");
|
||||
|
||||
if($edytuj_samochod)
|
||||
|
||||
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
} //else
|
||||
|
||||
BREAK;
|
||||
|
||||
case "edytuj_naprawe":
|
||||
|
||||
if(!is_numeric($_GET['id_nap']))
|
||||
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if(!isset($_POST['edytuj_naprawe']))
|
||||
|
||||
form_edytuj_naprawe($_GET['id_nap']);
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['data_naprawy']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty naprawy!!!</span></center>'); else if (!sprawdz_date($_POST['data_naprawy']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data naprawy!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['naprawa']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wprowadzono rodzaju naprawy!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['lokalizacja']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano lokalizacji
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['koszt']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kosztu!!!</span></center>'); else if (!sprawdz_koszt($_POST['koszt']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma kosztu XX.XX!!!</span></center>');
|
||||
|
||||
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_edytuj_naprawe($_GET['id_nap']);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$edytuj_naprawe=mysql_query("update naprawa SET data_naprawy='".$_POST['data_naprawy']."',naprawa='".$_POST['naprawa']."',lokalizacja='".$_POST['lokalizacja']."',koszt='".$_POST['koszt']."',kilometry='".$_POST['kilometry']."',id_sam='".$_POST['id_sam']."' where id_nap='".$_GET['id_nap']."'");
|
||||
|
||||
$id2 = $_GET['id_nap'];
|
||||
|
||||
if($edytuj_naprawe)
|
||||
|
||||
{
|
||||
|
||||
$p_pojemnosc=$_FILES['plik1']['size'];//pojemnosc pliku
|
||||
|
||||
$p_typ=$_FILES['plik1']['type']; // typ pliku
|
||||
|
||||
$p_nazwa=$_FILES['plik1']['name']; // nazwa pliku
|
||||
|
||||
$p_smiec=$_FILES['plik1']['tmp_name']; // chwilowa nazwa pliku
|
||||
|
||||
|
||||
|
||||
$p_roz= array_pop(explode(".", $p_nazwa));
|
||||
|
||||
|
||||
|
||||
$max_size=round(($_POST['max_file_size']/1048576),3)."MB";
|
||||
|
||||
|
||||
|
||||
$poj_MB=round(($p_pojemnosc/1048576),2).'MB';
|
||||
|
||||
|
||||
|
||||
$losowa = rand(1,100000000);
|
||||
|
||||
$liczba = $losowa + $p_pojemnosc;
|
||||
|
||||
$p_nazwa_zm=(md5($liczba)).".".$p_roz;
|
||||
|
||||
$folder="naprawa/";
|
||||
|
||||
if (($_FILES['plik1']['type']=="image/pjpeg") OR ($_FILES['plik1']['type']=="image/jpeg") OR ($_FILES['plik1']['type']=="application/pdf")){
|
||||
|
||||
if(@move_uploaded_file($p_smiec, $folder.$p_nazwa_zm)) {
|
||||
|
||||
echo "<center>Przeslanie pliku powiod³o siê - <b>".$k_nieb.$p_nazwa."</b>"." ".$poj_MB."</center>";
|
||||
|
||||
$path_file=$folder.$p_nazwa_zm;
|
||||
|
||||
$zapytanie=mysql_query("insert into naprawa_pliki values('','.$id2.','$path_file')");
|
||||
|
||||
$zapytanie2=mysql_query("update naprawa SET plik='1' where id_nap='".$id2."'");
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
exit('<center><b>Nie mozna zachowac pliku. Prawdopodobnie nie ma folderu lub plik jest za du¿y - max 250 kB</b></center>');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
uwaga('<b><center><p>Zmiany zosta³y wprowadzone</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
} //else
|
||||
|
||||
BREAK;
|
||||
|
||||
case "usun_plik":
|
||||
|
||||
if(!is_numeric($_GET['id_pn']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$usun_plik=mysql_query("select nazwa,id_nap from naprawa_pliki where id_pn='".$_GET['id_pn']."'");
|
||||
|
||||
$n=mysql_fetch_array($usun_plik);
|
||||
|
||||
$usun=mysql_query("delete from naprawa_pliki where id_pn='".$_GET['id_pn']."'");
|
||||
|
||||
$zapytanie2=mysql_query("select id_nap from naprawa_pliki where id_nap='".$n[1]."'");
|
||||
|
||||
$z=mysql_fetch_array($zapytanie2);
|
||||
|
||||
if ($z[0]==0)
|
||||
|
||||
{
|
||||
|
||||
$zapytanie3=mysql_query("update naprawa SET plik='0' where id_nap='".$n[1]."'");
|
||||
|
||||
}
|
||||
|
||||
if($usun)
|
||||
|
||||
{
|
||||
|
||||
echo('<center><br><b>Plik zosta³o usuniêty</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
unlink ($n[0]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ pliku</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
|
||||
|
||||
case "usun_samochod":
|
||||
|
||||
if(!is_numeric($_GET['id_sam']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$usun=mysql_query("delete from samochody where id_sam='".$_GET['id_sam']."'");
|
||||
|
||||
if($usun)
|
||||
|
||||
echo('<center><br><b>Samochód zosta³ usuniêty</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ Samochodu</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "usun_naprawe":
|
||||
|
||||
if(!is_numeric($_GET['id_nap']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$usun=mysql_query("delete from naprawa where id_nap='".$_GET['id_nap']."'");
|
||||
|
||||
if($usun)
|
||||
|
||||
echo('<center><br><b>Naprawa zosta³a usuniêta</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ Naprawy</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "pokaz_samochod":
|
||||
|
||||
form_poka¿_samochod($_GET['id_sam']);
|
||||
|
||||
BREAK;
|
||||
|
||||
case "pokaz_naprawe":
|
||||
|
||||
form_poka¿_naprawe($_GET['id_nap']);
|
||||
|
||||
BREAK;
|
||||
|
||||
case "dodaj_samochod":
|
||||
|
||||
|
||||
|
||||
if(!isset($_POST['dodaj_samochod']))
|
||||
|
||||
form_dodaj_samochod(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
// sprawdzanie formularza
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['auto']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nazwê auta!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['nr_rej']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ nr rejestracji!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['rok_auta']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano roku auta!!!</span></center>'); else if (!sprawdz_rok($_POST['rok_auta']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR - rok zakupu!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['data_zakupu']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty zakupu auta!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['data_zakupu']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data zakupu!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['oc']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano OC!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['oc']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - OC!!!</span></center>'); if(strlen(trim($_POST['ac']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano AC!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['ac']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - AC!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['przeglad']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty przegl±du
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['przeglad']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - przegl±d!!!</span></center>');
|
||||
|
||||
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_dodaj_samochod();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$dodaj_samochod=mysql_query("insert into samochody values('','".$_POST['auto']."','".$_POST['nr_rej']."','".$_POST['przypisany']."','".$_POST['rok_auta']."','".$_POST['data_zakupu']."','".$_POST['oc']."','".$_POST['ac']."','".$_POST['ubezpieczenia']."','".$_POST['przeglad']."','".$_POST['uwagi']."','0','0')");
|
||||
|
||||
if($dodaj_samochod)
|
||||
|
||||
uwaga('<center><br><b>Samochod zosta³ dodany</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ Samochodu</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "dodaj_naprawe":
|
||||
|
||||
|
||||
|
||||
if(!isset($_POST['dodaj_naprawe']))
|
||||
|
||||
form_dodaj_naprawe(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
// sprawdzanie formularza
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['data_naprawy']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty naprawy!!!</span></center>'); else if (!sprawdz_date($_POST['data_naprawy']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD - data naprawy!!!</span></center>');
|
||||
|
||||
if(($_POST['id_sam'])==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wybrano samochodu!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['naprawa']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie wprowadzono rodzaju naprawy!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['lokalizacja']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano lokalizacji
|
||||
|
||||
!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['koszt']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano kosztu!!!</span></center>'); else if (!sprawdz_koszt($_POST['koszt']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma kosztu XX.XX!!!</span></center>');
|
||||
|
||||
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_dodaj_naprawe();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$dodaj_samochod=mysql_query("insert into naprawa values('','".$_POST['data_naprawy']."','".$_POST['id_sam']."','".$_POST['naprawa']."','".$_POST['lokalizacja']."','".$_POST['koszt']."','0','".$_POST['kilometry']."')");
|
||||
|
||||
$id2 = mysql_insert_id();
|
||||
|
||||
if($dodaj_samochod)
|
||||
|
||||
{
|
||||
|
||||
$p_pojemnosc=$_FILES['plik1']['size'];//pojemnosc pliku
|
||||
|
||||
$p_typ=$_FILES['plik1']['type']; // typ pliku
|
||||
|
||||
$p_nazwa=$_FILES['plik1']['name']; // nazwa pliku
|
||||
|
||||
$p_smiec=$_FILES['plik1']['tmp_name']; // chwilowa nazwa pliku
|
||||
|
||||
|
||||
|
||||
$p_roz= array_pop(explode(".", $p_nazwa));
|
||||
|
||||
|
||||
|
||||
$max_size=round(($_POST['max_file_size']/1048576),3)."MB";
|
||||
|
||||
|
||||
|
||||
$poj_MB=round(($p_pojemnosc/1048576),2).'MB';
|
||||
|
||||
$losowa = rand(1,100000000);
|
||||
|
||||
$liczba = $losowa + $p_pojemnosc;
|
||||
|
||||
$p_nazwa_zm=(md5($liczba)).".".$p_roz;
|
||||
|
||||
$folder="naprawa/";
|
||||
|
||||
if (($_FILES['plik1']['type']=="image/pjpeg") OR ($_FILES['plik1']['type']=="image/jpeg") OR ($_FILES['plik1']['type']=="application/pdf")){
|
||||
|
||||
if(@move_uploaded_file($p_smiec, $folder.$p_nazwa_zm)) {
|
||||
|
||||
echo "<center>Przeslanie pliku powiod³o siê - <b>".$k_nieb.$p_nazwa."</b>"." ".$poj_MB."</center>";
|
||||
|
||||
$path_file=$folder.$p_nazwa_zm;
|
||||
|
||||
$zapytanie=mysql_query("insert into naprawa_pliki values('','.$id2.','$path_file')");
|
||||
|
||||
$zapytanie2=mysql_query("update naprawa SET plik='1' where id_nap='".$id2."'");
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
exit('<center><b>Nie mozna zachowac pliku. Prawdopodobnie nie ma folderu lub plik jest za du¿y - max 250 kB</b></center>');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
uwaga('<center><br><b>Naprawa zosta³a dodanana</b></center><p>');
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ Naprawy</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
case "show_samochod":
|
||||
|
||||
|
||||
|
||||
|
||||
echo' <center><form action=?co=samochod&kto=show_samochod method=post>
|
||||
|
||||
<table><tr><td colspan=2 align=center><b>Opcje wyszukiwania</b></td></tr></table>
|
||||
|
||||
<table><tr>
|
||||
|
||||
<tr> <td><input type="radio" name="jakist" value="" /> Wszystkie</td></tr>
|
||||
<tr> <td><input type="radio" name="jakist" value="1" /> Sprzedane</td></tr>
|
||||
<tr><td><input type="radio" checked="checked" name="jakist" value="0" /> U¿ytkowane</td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan=2 align=center><b>Opcje sortowanie</b></td></tr>
|
||||
<tr><td><input type="radio" name="jakisort" value="a.ocac" /> Data OC</td><td>
|
||||
<tr><td><input type="radio" name="jakisort" value="a.przeglad" /> Data przegladu</td><td>
|
||||
<tr><td><input type="radio" checked="checked" name="jakisort" value="a.rok_auta" /> Rocznik samochodu</td><td>
|
||||
|
||||
|
||||
<tr><td> <input type=submit class=submit name=szukaj_samochod value="Szukaj"></center></td></tr>
|
||||
|
||||
</table></form></center> ';
|
||||
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$jakisort=$_POST['jakisort'];
|
||||
|
||||
$data1=date("Y-m-d",strtotime("+14 days",time()));
|
||||
if ($jakisort=='')
|
||||
{
|
||||
$jakisort='a.rok_auta';
|
||||
$jakist=0;
|
||||
} else
|
||||
|
||||
{
|
||||
$jakisort=$_POST['jakisort'];
|
||||
$jakist=$_POST['jakist']; }
|
||||
$pobierz_samochod=mysql_query("select a.id_sam,a.auto,a.nr_rej,a.status,b.imie,b.nazwisko,a.rok_auta,a.rok_zakupu,a.ocac,a.ocac2,c.ubezpieczenia,a.przeglad from samochody a,uzytkownicy b,ubezpieczenia c where a.id=b.id and a.id_ube=c.id_ube and a.status like '%$jakist%' order by $jakisort asc");
|
||||
|
||||
if(mysql_num_rows($pobierz_samochod)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wproadzonych samochodów!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
|
||||
|
||||
echo '<center><table width=98%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa auta</b></td><td><b>Nr rejest.</b></td><td><b>Przypisany</b></td><td><b>Rok auta</b></td><td><b>Data zakupu</b></td><td><b>OC</b></td><td><b>Wymiana oleju</b></td><td><b>Ubezpieczenie</b></td><td><b>Przegl±d</b></td><td><b>Stan km</b></td><td><b>Status</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_samochod))
|
||||
|
||||
{
|
||||
|
||||
if($u['status']=='0') $status='u¿ywany'; else { $status= 'sprzedany';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_samochod&id_sam='.$u['id_sam'].' target="_blank">Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_samochod&id_sam='.$u['id_sam'].'>Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_samochod&id_sam='.$u['id_sam'].' onclick="return confirm(\'Napewno chcesz usun±æ ten Samochód\')">Usuñ</a>';
|
||||
|
||||
$data2 = $u['przeglad'];
|
||||
|
||||
if (($data2 <= $data1) and ($u['status']=='0'))
|
||||
|
||||
{
|
||||
|
||||
$color='#FCA1A1';
|
||||
|
||||
}
|
||||
|
||||
$data3 = $u['ocac'];
|
||||
|
||||
if (($data3 <= $data1) and ($u['status']=='0'))
|
||||
|
||||
{
|
||||
|
||||
$color='#FCA1A1';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($u['status']=='1')
|
||||
|
||||
{
|
||||
|
||||
$color='#D4D6FC';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql=mysql_query("SELECT kmstop FROM kilometry where id_sam='".$u['id_sam']."' ORDER BY id_kil DESC LIMIT 1");
|
||||
|
||||
|
||||
|
||||
while($a=mysql_fetch_array($sql))
|
||||
|
||||
{
|
||||
|
||||
$kmstop = $a['kmstop'];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['auto'].'</td><td><center>'.$u['nr_rej'].'</center></td><td><center>'.$u['imie'].' '.$u['nazwisko'].'</center></td><td><center>'.$u['rok_auta'].'</center></td><td><center>'.$u['rok_zakupu'].'</center></td><td><center>'.$u['ocac'].'</center></td><td><center>'.$u['ocac2'].'</center></td><td><center>'.$u['ubezpieczenia'].'</center></td><td><center>'.$u['przeglad'].'</center></td><td><center>'.$kmstop.' km</center></td><td><center>'.$status.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
echo '</table></center> ';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "szukaj_samochod":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_samochod=mysql_query("select a.id_sam,a.auto,a.nr_rej,b.imie,b.nazwisko,a.rok_auta,a.rok_zakupu,a.ocac,c.ubezpieczenia,a.przeglad from samochody a,uzytkownicy b,ubezpieczenia c where a.id=b.id and a.id_ube=c.id_ube and a.auto like'%".$_POST['auto']."%' and a.nr_rej like'%".$_POST['nrrej']."%' and a.rok_auta like'%".$_POST['rokauta']."%' and a.id_ube='".$_POST['id_ube']."' order by a.auto asc");
|
||||
|
||||
if(mysql_num_rows($pobierz_samochod)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wproadzonych samochodów!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=98%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa auta</b></td><td><b>Nr rejest.</b></td><td><b>Przypisany</b></td><td><b>Rok auta</b></td><td><b>Data zakupu</b></td><td><b>OC/AC</b></td><td><b>Ubezpieczyciel</b></td><td><b>Przegl±d</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_samochod))
|
||||
|
||||
{
|
||||
|
||||
$sql=mysql_query("SELECT kmstop FROM kilometry where id_sam='".$u['id_sam']."' ORDER BY kmstop DESC LIMIT 1");
|
||||
|
||||
while($a=mysql_fetch_array($sql))
|
||||
|
||||
{
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_samochod&id_sam='.$u['id_sam'].' target="_blank">Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_samochod&id_sam='.$u['id_sam'].'>Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_samochod&id_sam='.$u['id_sam'].' onclick="return confirm(\'Napewno chcesz usun±æ ten Samochód\')">Usuñ</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px">'.$u['auto'].'</td><td><center>'.$u['nr_rej'].'</center></td><td><center>'.$u['imie'].' '.$u['nazwisko'].'</center></td><td><center>'.$u['rok_auta'].'</center></td><td><center>'.$u['rok_zakupu'].'</center></td><td><center>'.$u['ocac'].'</center></td><td><center>'.$u['ubezpieczenia'].'</center></td><td><center>'.$a['kmstop'].' km</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "show_naprawa":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_naprawe=mysql_query("select a.id_nap,a.plik,a.data_naprawy,a.kilometry,b.auto,b.nr_rej,a.naprawa,a.lokalizacja,a.koszt from naprawa a,samochody b where a.id_sam=b.id_sam order by a.data_naprawy desc");
|
||||
|
||||
if(mysql_num_rows($pobierz_naprawe)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wprowadzonej naprawy!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
form_szukaj_naprawe();
|
||||
|
||||
$zapytanie=mysql_query("select sum(koszt) as koszt from naprawa");
|
||||
|
||||
$z= mysql_fetch_array($zapytanie);
|
||||
|
||||
echo '<center><table width=95%><tr width=70% align=center><td></td></tr>';
|
||||
|
||||
echo '<br>';
|
||||
|
||||
echo "Suma kwoty napraw: <b>".$z[koszt]. "</b> PLN<br><br>";
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data naprawy</b></td><td><b>Nazwa auta</b></td><td><b>Rodzaj naprawy</b></td><td><b>Lokalizacja</b></td><td><b>Koszt</b></td><td><b>Kilometry</b></td><td><b>Pliki</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_naprawe))
|
||||
|
||||
{
|
||||
|
||||
if(strlen(trim($u['plik'])==1))
|
||||
|
||||
$plik='<span style="color:#198020">JEST</span>';
|
||||
|
||||
else
|
||||
|
||||
$plik='<span style="color:#FF0000">BRAK</span>';
|
||||
|
||||
$naprawa = str_split($u['naprawa'], 200);
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_naprawe&id_nap='.$u['id_nap'].' target="_blank">Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_naprawe&id_nap='.$u['id_nap'].'>Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_naprawe&id_nap='.$u['id_nap'].' onclick="return confirm(\'Napewno chcesz usun±æ t± Naprawe\')">Usuñ</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_naprawy'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td>'.$naprawa[0].'</td><td><center>'.$u['lokalizacja'].'</center></td><td><center>'.$u['koszt'].' PLN</center></td><td><center>'.$u['kilometry'].'</center></td><td><center>'.$plik.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "szukaj_naprawe":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_naprawe=mysql_query("select a.id_nap,a.kilometry,a.data_naprawy,a.plik,b.auto,b.nr_rej,a.naprawa,a.lokalizacja,a.koszt from naprawa a,samochody b where a.id_sam=b.id_sam and b.id_sam='".$_POST['id_sam']."' and a.data_naprawy like '%".$_POST['data']."%' and a.lokalizacja like '%".$_POST['lokalizacja']."%' order by a.data_naprawy desc");
|
||||
|
||||
if(mysql_num_rows($pobierz_naprawe)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma ¿adnych wprowadzonej naprawy!!!</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
$_POST['data']='';
|
||||
|
||||
$_POST['nr_rej']='';
|
||||
|
||||
$_POST['lokalizacja']='';
|
||||
|
||||
form_szukaj_naprawe();
|
||||
|
||||
|
||||
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data naprawy</b></td><td><b>Nazwa auta</b></td><td><b>Rodzaj naprawy</b></td><td><b>Lokalizacja</b></td><td><b>Koszt</b></td><td><b>Kilometry</b></td><td><b>Pliki</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_naprawe))
|
||||
|
||||
{
|
||||
|
||||
if(strlen(trim($u['plik'])==1))
|
||||
|
||||
$plik='<span style="color:#198020">JEST</span>';
|
||||
|
||||
else
|
||||
|
||||
$plik='<span style="color:#FF0000">BRAK</span>';
|
||||
|
||||
$naprawa2 = str_split($u['naprawa'], 200);
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
$opcje1='<a class=link href=?co=samochod&kto=pokaz_naprawe&id_nap='.$u['id_nap'].' target="_blank">Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=samochod&kto=edytuj_naprawe&id_nap='.$u['id_nap'].'>Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=samochod&kto=usun_naprawe&id_nap='.$u['id_nap'].' onclick="return confirm(\'Napewno chcesz usun±æ t± Naprawe\')">Usuñ</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_naprawy'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td>'.$naprawa2[0].'</td><td><center>'.$u['lokalizacja'].'</center></td><td><center>'.$u['koszt'].'</center></td><td><center>'.$u['kilometry'].'</center></td><td><center>'.$plik.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
$zapytanie=mysql_query("select sum(a.koszt) as koszt from naprawa a,samochody b where a.id_sam=b.id_sam and b.id_sam='".$_POST['id_sam']."'");
|
||||
|
||||
$z= mysql_fetch_array($zapytanie);
|
||||
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=70% align=center><td></td></tr>';
|
||||
|
||||
echo '<br>';
|
||||
|
||||
echo "Suma kwoty napraw: <b>".$z[koszt]. "</b> PLN";
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
136
style.css
Normal file
136
style.css
Normal file
@ -0,0 +1,136 @@
|
||||
BODY {
|
||||
MARGIN-TOP: 5px; FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, sans-serif
|
||||
}
|
||||
TD {
|
||||
FONT-SIZE: 11px; FONT-FAMILY: Verdana, Arial, sans-serif
|
||||
}
|
||||
SMALL {
|
||||
FONT-SIZE: 10px; FONT-FAMILY: Verdana, Arial, sans-serif
|
||||
}
|
||||
FORM {
|
||||
MARGIN: 0px
|
||||
}
|
||||
A {
|
||||
TEXT-DECORATION: none
|
||||
}
|
||||
A.lmenu {
|
||||
COLOR: #000000
|
||||
}
|
||||
A:hover {
|
||||
TEXT-DECORATION: underline
|
||||
}
|
||||
.main {
|
||||
FONT-SIZE: 11px; COLOR: #333333; FONT-FAMILY: Tahoma, Helvetica, sans-serif
|
||||
}
|
||||
.smain {
|
||||
FONT-SIZE: 9px; COLOR: #333333; FONT-FAMILY: Tahoma, Helvetica, sans-serif
|
||||
}
|
||||
.menu-sep {
|
||||
FONT-SIZE: 10px; COLOR: #ffffff; FONT-FAMILY: Tahoma, Verdana
|
||||
}
|
||||
.menu {
|
||||
FONT-WEIGHT: FONT-SIZE: 12px; COLOR: #404040; FONT-FAMILY: Tahoma, Verdana
|
||||
}
|
||||
.menu2 {
|
||||
FONT-SIZE: 10px; COLOR: #404040; FONT-FAMILY: Tahoma, Verdana
|
||||
}
|
||||
.menu3 {
|
||||
FONT-SIZE: 12px; COLOR: #404040; FONT-FAMILY: Tahoma, Verdana
|
||||
}
|
||||
.topmenu {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #000000; FONT-FAMILY: Verdana
|
||||
}
|
||||
.topmenu2 {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #cc3300; FONT-FAMILY: Verdana
|
||||
}
|
||||
.pomoc {
|
||||
FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #ffffff; FONT-FAMILY: Tahoma, Verdana
|
||||
}
|
||||
.title {
|
||||
PADDING-RIGHT: 10px; FONT-WEIGHT: bold; FONT-SIZE: 18px; COLOR: #cfcfcf; FONT-FAMILY: Arial
|
||||
}
|
||||
.black {
|
||||
COLOR: #000000
|
||||
}
|
||||
.submit {
|
||||
BORDER-RIGHT: #d6d6d6 1px solid; BORDER-TOP: #d6d6d6 1px solid; FONT-WEIGHT: bold; FONT-SIZE: 11px; BORDER-LEFT: #d6d6d6 1px solid; WIDTH: 100px; COLOR: #333333; BORDER-BOTTOM: #d6d6d6 1px solid; BACKGROUND-COLOR: #f2f2f2
|
||||
}
|
||||
.input {
|
||||
FONT-SIZE: 13px; FONT-FAMILY: arial
|
||||
}
|
||||
.homepl-black {
|
||||
FONT-WEIGHT: bold; COLOR: #000000
|
||||
}
|
||||
.homepl-red {
|
||||
FONT-WEIGHT: bold; COLOR: #cc3300
|
||||
}
|
||||
.nopadd {
|
||||
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px
|
||||
}
|
||||
H3 {
|
||||
PADDING-LEFT: 15px; FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR: #777777; FONT-FAMILY: monospace
|
||||
}
|
||||
.sep-top {
|
||||
BACKGROUND-IMAGE: url(/gfx/home-gr-gray/sep-top.gif); BACKGROUND-COLOR: #939393
|
||||
}
|
||||
.lmenu-sep-top {
|
||||
BACKGROUND-IMAGE: url(/gfx/home-gr-gray/sep-top.gif); BACKGROUND-COLOR: #939393
|
||||
}
|
||||
.sep-mid {
|
||||
PADDING-RIGHT: 0px; PADDING-LEFT: 0px; BACKGROUND-IMAGE: url(/gfx/home-gr-gray/sep-top.gif); PADDING-BOTTOM: 0px; PADDING-TOP: 0px; BACKGROUND-COLOR: #cccccc
|
||||
}
|
||||
.th {
|
||||
FONT-WEIGHT: bold; BACKGROUND-COLOR: #ffffff
|
||||
}
|
||||
.ttitle {
|
||||
FONT-WEIGHT: bold; COLOR: #cc3300
|
||||
}
|
||||
.lmenutitle {
|
||||
FONT-WEIGHT: bold; COLOR: #000000
|
||||
}
|
||||
.navbar {
|
||||
COLOR: #000000
|
||||
}
|
||||
.kbtab1 {
|
||||
BORDER-RIGHT: #dedede 0px solid; PADDING-RIGHT: 7px; BORDER-TOP: #dedede 0px solid; PADDING-LEFT: 7px; FONT-WEIGHT: normal; FONT-SIZE: 11px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedede 1px solid; COLOR: #333333; PADDING-TOP: 2px; BORDER-BOTTOM: #dedede 1px solid; FONT-FAMILY: tahoma; TEXT-DECORATION: none
|
||||
}
|
||||
.kbtab2 {
|
||||
BORDER-RIGHT: #dedede 1px solid; PADDING-RIGHT: 7px; BORDER-TOP: #dedede 0px solid; PADDING-LEFT: 7px; FONT-WEIGHT: normal; FONT-SIZE: 11px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedede 1px solid; COLOR: #333333; PADDING-TOP: 2px; BORDER-BOTTOM: #dedede 1px solid; FONT-FAMILY: tahoma; TEXT-DECORATION: none
|
||||
}
|
||||
.kbtab3 {
|
||||
BORDER-RIGHT: #dedede 1px solid; PADDING-RIGHT: 7px; BORDER-TOP: #dedede 0px solid; PADDING-LEFT: 7px; FONT-WEIGHT: normal; FONT-SIZE: 11px; PADDING-BOTTOM: 2px; BORDER-LEFT: #dedede 0px solid; COLOR: #333333; PADDING-TOP: 2px; BORDER-BOTTOM: #dedede 1px solid; FONT-FAMILY: tahoma; TEXT-DECORATION: none
|
||||
}
|
||||
#tooltip {
|
||||
BORDER-RIGHT: #000000 1px solid; PADDING-RIGHT: 3px; BORDER-TOP: #000000 1px solid; PADDING-LEFT: 3px; FONT-SIZE: 10px; BACKGROUND: #f6f6f6; FILTER: alpha(opacity=92); PADDING-BOTTOM: 3px; BORDER-LEFT: #000000 1px solid; COLOR: #000000; PADDING-TOP: 3px; BORDER-BOTTOM: #000000 1px solid; FONT-FAMILY: Verdana; POSITION: absolute; moz-opacity: 0.92; opacity: 0.92
|
||||
}
|
||||
.waitDiv {
|
||||
Z-INDEX: 110; LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px
|
||||
}
|
||||
.waitDivBg {
|
||||
Z-INDEX: 100; FILTER: alpha(opacity=40); LEFT: 0px; WIDTH: 100%; POSITION: absolute; TOP: 0px; HEIGHT: 500px; BACKGROUND-COLOR: #707070; moz-opacity: 0.4; opacity: 0.4
|
||||
}
|
||||
.waitDivInner {
|
||||
BORDER-RIGHT: #525252 1px solid; PADDING-RIGHT: 30px; BORDER-TOP: #525252 1px solid; PADDING-LEFT: 30px; Z-INDEX: 101; FILTER: alpha(opacity=90); LEFT: 0px; PADDING-BOTTOM: 15px; BORDER-LEFT: #525252 1px solid; PADDING-TOP: 15px; BORDER-BOTTOM: #525252 1px solid; POSITION: absolute; TOP: 0px; BACKGROUND-COLOR: #fff; TEXT-ALIGN: center; moz-opacity: 0.9; opacity: 0.9
|
||||
}
|
||||
.waitdiv P {
|
||||
MARGIN: 5px 0px 0px; FONT: 12px arial; COLOR: #959595
|
||||
}
|
||||
div#stopka
|
||||
{
|
||||
color:#212121;
|
||||
clear:both;
|
||||
|
||||
text-align:center;
|
||||
vertical-align:middle;
|
||||
height:1.6em;
|
||||
padding:0px;
|
||||
margin-top:15px;
|
||||
}
|
||||
.data {
|
||||
color: #ffffff;
|
||||
font-size: 12px;
|
||||
font-family: tahoma;
|
||||
}
|
||||
.link {
|
||||
FONT-WEIGHT: FONT-SIZE: 12px; COLOR: #404040; FONT-FAMILY: Tahoma, Verdana
|
||||
}
|
||||
880
tankowania.php
Normal file
880
tankowania.php
Normal file
@ -0,0 +1,880 @@
|
||||
<?
|
||||
|
||||
$sprawdzanie_uzytkownika=mysql_query("select uprawnienia1 from uzytkownicy where uprawnienia1='0' and id='".$_SESSION['id']."'") or die(mysql_error());
|
||||
|
||||
if(mysql_num_rows($sprawdzanie_uzytkownika)>0)
|
||||
|
||||
{
|
||||
|
||||
echo '<table width="740" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><a class= link href="?co=tankowania&kto=dodaj">Dodaj Tankowanie</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=tankowania&kto=show">Zarzadzaj Tankowaniem - wszystkie</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=tankowania&kto=show2">Zarzadzaj Tankowaniem - 30 dni</a></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table><p>';
|
||||
|
||||
IF(isset($_GET['akcja']))
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['akcja'])
|
||||
|
||||
{
|
||||
|
||||
case "pokaz":
|
||||
|
||||
form_poka¿_tankowania($_GET['id_tan']);
|
||||
|
||||
BREAK;
|
||||
|
||||
case "edytuj":
|
||||
|
||||
if(!is_numeric($_GET['id_tan']))
|
||||
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if(!isset($_POST['edytuj_tankowania']))
|
||||
|
||||
form_edytuj_tankowania($_GET['id_tan']);
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['data']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['data']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
||||
|
||||
if ($_POST['id_sam']==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['stankm']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_liczbe($_POST['stankm']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['litry']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_edytuj_tankowania($_GET['id_tan']);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$edytuj_tankowania=mysql_query("update tankowania SET data_tan='".$_POST['data']."',stankm='".$_POST['stankm']."',litry='".$_POST['litry']."',wyjazd='".$_POST['wyjazd']."' where id_tan='".$_GET['id_tan']."'");
|
||||
|
||||
if($edytuj_tankowania)
|
||||
|
||||
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
} //else
|
||||
|
||||
BREAK;
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['kto'])
|
||||
|
||||
{
|
||||
|
||||
case "dodaj":
|
||||
|
||||
|
||||
|
||||
if(!isset($_POST['dodaj_tankowania']))
|
||||
|
||||
form_dodaj_tankowania(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
// sprawdzanie formularza
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['data']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['data']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
||||
|
||||
if ($_POST['id_sam']==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['stankm']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_liczbe($_POST['stankm']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['litry']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_dodaj_tankowania();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$dodaj_tankowania=mysql_query("insert into tankowania values('','".$_POST['data']."','".$_SESSION['id']."','".$_POST['id_sam']."','".$_POST['stankm']."','".$_POST['litry']."','0','".$_POST['wyjazd']."')");
|
||||
|
||||
if($dodaj_tankowania)
|
||||
|
||||
{
|
||||
|
||||
uwaga('<center><br><b>Tankowanie zosta³o dodane</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ Tankowanie</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case "show":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id='".$_SESSION['id']."' order by data_tan desc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
form_szukaj_tankowania();
|
||||
|
||||
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].'>Edytuj</a>';
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej']. '</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "show2":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$data=date("Y-m-d",strtotime("-0 days",time()));
|
||||
|
||||
$data2=date("Y-m-d",strtotime("-30 days",time()));
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id='".$_SESSION['id']."' and a.data_tan>='".$data2."' and a.data_tan<='".$data."' order by data_tan desc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
form_szukaj_tankowania();
|
||||
|
||||
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>StanKm</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].'>Edytuj</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "szukaj_tankowania":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id='".$_SESSION['id']."' and a.data_tan >= '".$_POST['data1']."' and a.data_tan <= '".$_POST['data2']."' order by data_tan desc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>StanKm</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
echo '<table width="740" border="0" align="center">
|
||||
|
||||
<tr>
|
||||
|
||||
<td><div align="center"><a class= link href="?co=tankowania&kto=dodaj_admin">Dodaj Tankowanie</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=tankowania&kto=show_admin">Zarzadzaj Tankowaniem - wszystkie</a></div></td>
|
||||
|
||||
<td><div align="center"><a class=link href="?co=tankowania&kto=show_admin2">Zarzadzaj Tankowaniem - 30 dni</a></div></td>
|
||||
|
||||
</tr>
|
||||
|
||||
</table><p>';
|
||||
|
||||
IF(isset($_GET['akcja']))
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['akcja'])
|
||||
|
||||
{
|
||||
|
||||
case "usun_admin":
|
||||
|
||||
if(!is_numeric($_GET['id_tan']))
|
||||
|
||||
uwaga('Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$usun=mysql_query("update tankowania SET usun='1' where id_tan='".$_GET['id_tan']."'");
|
||||
|
||||
if($usun)
|
||||
|
||||
echo('<center><br><b>Tankowanie zosta³o usuniête<center><br><b>');
|
||||
|
||||
else
|
||||
|
||||
echo('<center><br><b>Nie mozna by³o usun±æ Tankowania<center><br><b>');
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "pokaz_admin":
|
||||
|
||||
form_poka¿_tankowania_admin($_GET['id_tan']);
|
||||
|
||||
BREAK;
|
||||
|
||||
case "edytuj_admin":
|
||||
|
||||
if(!is_numeric($_GET['id_tan']))
|
||||
|
||||
uwaga(BLAD. ' Brak danych!');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if(!isset($_POST['edytuj_tankowania_admin']))
|
||||
|
||||
form_edytuj_tankowania_admin($_GET['id_tan']);
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['data']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['data']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
||||
|
||||
if ($_POST['id_sam']==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['stankm']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_liczbe($_POST['stankm']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['litry']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_edytuj_tankowania_admin($_GET['id_tan']);
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$edytuj_tankowania_admin=mysql_query("update tankowania SET data_tan='".$_POST['data']."',id='".$_POST['id']."',id_sam='".$_POST['id_sam']."',stankm='".$_POST['stankm']."',litry='".$_POST['litry']."',wyjazd='".$_POST['wyjazd']."' where id_tan='".$_GET['id_tan']."'");
|
||||
|
||||
if($edytuj_tankowania_admin)
|
||||
|
||||
uwaga('<center><br><b>Zmiany zosta³y wprowadzone</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mozna by³o wprowadziæ zmian</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
} //else
|
||||
|
||||
BREAK;
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_GET['kto'])) // opcje g³owne .. czyli dodawanie userów i wyswietlanie ich zarzadzanai
|
||||
|
||||
{
|
||||
|
||||
switch($_GET['kto'])
|
||||
|
||||
{
|
||||
|
||||
case "dodaj_admin":
|
||||
|
||||
|
||||
|
||||
if(!isset($_POST['dodaj_tankowania_admin']))
|
||||
|
||||
form_dodaj_tankowania_admin(); // jezeli nie probowano dodac usera to wyswietla formularz
|
||||
|
||||
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
// sprawdzanie formularza
|
||||
|
||||
$blad='';
|
||||
|
||||
if(strlen(trim($_POST['data']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Nie podano daty!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_date($_POST['data']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma daty RRRR-MM-DD !!!</span></center>');
|
||||
|
||||
if ($_POST['id_sam']==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz wybraæ samochód!!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['stankm']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Stan licznika!!!</span></center>');
|
||||
|
||||
else if (!sprawdz_liczbe($_POST['stankm']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Stan Km !!!</span></center>');
|
||||
|
||||
if(strlen(trim($_POST['litry']))==0)
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Musisz podaæ Litry!!!</span></center>'); else if (!sprawdz_liczbe($_POST['litry']))
|
||||
|
||||
$blad.=('<center><span style="color:#FF0000">Z³a forma Litrów !!!</span></center>');
|
||||
|
||||
// koniec sprawdzania danych
|
||||
|
||||
if($blad)
|
||||
|
||||
{
|
||||
|
||||
uwaga($blad);
|
||||
|
||||
form_dodaj_tankowania_admin();
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$dodaj_kilometry_admin=mysql_query("insert into tankowania values('','".$_POST['data']."','".$_POST['id']."','".$_POST['id_sam']."','".$_POST['stankm']."','".$_POST['litry']."','0','".$_POST['wyjazd']."')");
|
||||
|
||||
if($dodaj_kilometry_admin)
|
||||
|
||||
{
|
||||
|
||||
uwaga('<center><br><b>Tankowanie zosta³ dodany</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
uwaga('<center><br><b>Nie mo¿na by³o dodaæ
|
||||
|
||||
tankowania</b></center><p>');
|
||||
|
||||
}
|
||||
|
||||
}//else
|
||||
|
||||
break;
|
||||
|
||||
case "show_admin":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam order by data_tan DESC");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
form_szukaj_tankowania_admin();
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz_admin&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj_admin&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=tankowania&akcja=usun_admin&id_tan='.$u['id_tan'].' onclick="return confirm(\'Napewno chcesz usun±æ tankowanie\')">Usuñ</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "show_admin2":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
$data=date("Y-m-d",strtotime("-0 days",time()));
|
||||
|
||||
$data2=date("Y-m-d",strtotime("-30 days",time()));
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.data_tan>='".$data2."' and a.data_tan<='".$data."' order by data_tan DESC");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>
|
||||
|
||||
');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$color=$color1;
|
||||
|
||||
form_szukaj_tankowania_admin();
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz_admin&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj_admin&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=tankowania&akcja=usun_admin&id_tan='.$u['id_tan'].' onclick="return confirm(\'Napewno chcesz usun±æ tankowanie\')">Usuñ</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
case "szukaj_tankowania_admin":
|
||||
|
||||
// pobieranie userów
|
||||
|
||||
if ($_POST['auto']<>0) {
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.id_sam,c.id_sam,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.id_sam='".$_POST['auto']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
||||
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
if (($_POST['data1']==0) or ($_POST['data2']==0))
|
||||
|
||||
{
|
||||
|
||||
if ($_POST['id']==0)
|
||||
|
||||
{
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.id='".$_POST['id']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
if ($_POST['id']==0)
|
||||
|
||||
{
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.data_tan >= '".$_POST['data1']."' and a.data_tan <= '".$_POST['data2']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,c.nr_rej,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.usun='0' and a.id=b.id and a.id_sam=c.id_sam and a.data_tan >= '".$_POST['data1']."' and a.data_tan <= '".$_POST['data2']."' and a.id='".$_POST['id']."' and a.wyjazd like '%".$_POST['wyjazd']."%' order by data_tan DESC");
|
||||
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
form_szukaj_tankowania_admin();
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data:</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>Stan Km</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz_admin&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj_admin&id_tan='.$u['id_tan'].' target="_blank">Edytuj</a> | ';
|
||||
|
||||
$opcje2.='<a class=link href=?co=tankowania&akcja=usun_admin&id_tan='.$u['id_tan'].' onclick="return confirm(\'Napewno chcesz usun±æ tankowanie\')">Usuñ</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].' '.$u['nr_rej'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
}
|
||||
|
||||
BREAK;
|
||||
|
||||
} //switch
|
||||
|
||||
} //if
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
12
test.php
Normal file
12
test.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$czas = 2502139200;
|
||||
$m = date('t');
|
||||
$minut = sprintf("%02d",floor($czas /60)%60);
|
||||
$sekund = sprintf("%02d",floor($czas)%60);
|
||||
$godzin = sprintf("%02d",floor($czas/(60*60)%24));
|
||||
$tygodni = sprintf("%2d",floor($czas/(604800)%4));
|
||||
$dni = sprintf("%2d",floor($czas/(60*60*24)%$m));
|
||||
$miesiecy = sprintf("%2d",floor($czas/(60*60*24*$m)%12));
|
||||
$lat = sprintf("%2d",floor($czas / (365 * 24 * 60 * 60)%100));
|
||||
echo "Lat $lat Miesiecy $miesiecy Tygodni $tygodni Dni $dni Godzin $godzin Minut $minut Sekund $sekund";
|
||||
?>
|
||||
259
ustawienia.php
Normal file
259
ustawienia.php
Normal file
@ -0,0 +1,259 @@
|
||||
<?
|
||||
if(isset($_GET['kto']))
|
||||
{
|
||||
switch($_GET['kto'])
|
||||
{
|
||||
case "dodano_stanowisko":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select stanowisko from stanowisko where stanowisko='".$_POST['stanowisko']."' and usun='0' and id_sta <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['stanowisko']))==0)
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ nazwê stanowiska!!!</span></center><p>');
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
echo('<p><center><span style="color:#FF0000">Podane nazwa ju¿ istnieje!!!</span></center><p>');
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO `stanowisko` ( `id_sta` , `stanowisko` ) VALUES (NULL,'".$_POST['stanowisko']."')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update stanowisko SET stanowisko='".$_POST['stanowisko']."' where id_sta='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Stanowisko zosta³o dodane</b></center><p>');
|
||||
$_POST['stanowisko'] = '';
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ stanowiska w bazie</b></center><p>');
|
||||
$_POST['stanowisko'] = '';
|
||||
}
|
||||
}
|
||||
BREAK;
|
||||
case "dodano_akcje":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select akcja from akcja where akcja='".$_POST['akcja']."' and usun='0' and id_akc <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['akcja']))==0)
|
||||
echo('<center><br><b>Musisz podaæ nazwê akcji</b></center><p>');
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
echo('<center><br><b>Podane nazwa ju¿ istnieje</b></center><p>');
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO `akcja` ( `id_akc` , `akcja` ) VALUES (NULL,'".$_POST['akcja']."')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update akcja SET akcja='".$_POST['akcja']."' where id_akc='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Akcja zosta³o dodane</b></center><p>');
|
||||
$_POST['akcja'] = '';
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ akcji w bazie</span></center><p>');
|
||||
$_POST['akcja'] = '';
|
||||
}
|
||||
}
|
||||
BREAK;
|
||||
case "dodano_bank":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select bank from bank where bank='".$_POST['bank']."' and usun='0' and id_ban <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['bank']))==0)
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ nazwê banku</span></center><p>');
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
echo('<p><center><span style="color:#FF0000">Podana nazwa ju¿ istnieje</span></center><p>');
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO `bank` ( `id_ban` , `bank` ) VALUES (NULL,'".$_POST['bank']."')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update bank SET bank='".$_POST['bank']."' where id_ban='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Bank zosta³ dodany</b></center><p>');
|
||||
$_POST['bank'] = '';
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ banku w bazie</b></center><p>');
|
||||
$_POST['bank'] = '';
|
||||
}
|
||||
}
|
||||
BREAK;
|
||||
case "dodano_ubezpieczenie":
|
||||
if(!is_numeric($_GET['id']))
|
||||
$pobierz_kategoria=mysql_query("select ubezpieczenia from ubezpieczenia where ubezpieczenia='".$_POST['ubezpieczyciel']."' and usun='0' and id_ube <>'".$_GET['id']."'") or die(mysql_error());
|
||||
if(strlen(trim($_POST['ubezpieczyciel']))==0)
|
||||
echo('<p><center><span style="color:#FF0000">Musisz podaæ nazwê ubezpieczyciela!!!</span></center><p>');
|
||||
else if (mysql_num_rows($pobierz_kategoria)>0)
|
||||
echo('<p><center><span style="color:#FF0000">Podana nazwa ju¿ istnieje!!!</span></center><p>');
|
||||
else
|
||||
{
|
||||
{
|
||||
if($_POST['id']==0)
|
||||
$zapis_do_bazy=mysql_query("INSERT INTO `ubezpieczenia` ( `id_ube` , `ubezpieczenia` ) VALUES (NULL,'".$_POST['ubezpieczyciel']."')");
|
||||
else if($_POST['id']>0)
|
||||
{
|
||||
$zapis_do_bazy=mysql_query("update ubezpieczenia SET ubezpieczenia='".$_POST['ubezpieczyciel']."' where id_ube='".$_POST['id']."'");
|
||||
}
|
||||
if($zapis_do_bazy)
|
||||
{
|
||||
echo('<center><br><b>Ubezpieczyciel zosta³ dodany</b></center><p>');
|
||||
$_POST['ubezpieczyciel'] = '';
|
||||
}
|
||||
else
|
||||
echo('<center><br><b>Nie mo¿na by³o zapisaæ ubezpieczyciela w bazie</b></center><p>');
|
||||
$_POST['ubezpieczyciel'] = '';
|
||||
}
|
||||
}
|
||||
BREAK;
|
||||
case "edytuj_stanowisko":
|
||||
if(isset($_GET['id']))
|
||||
form_edytujstanowisko($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
case "edytuj_akcje":
|
||||
if(isset($_GET['id']))
|
||||
form_edytujakcje($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
case "edytuj_bank":
|
||||
if(isset($_GET['id']))
|
||||
form_edytujbank($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
case "edytuj_ubezpieczenia":
|
||||
if(isset($_GET['id']))
|
||||
form_edytujubezpieczyciel($_GET['id']);
|
||||
else
|
||||
echo('<p><center><span style="color:#FF0000">BRAK DANYCH</span></center><p>');
|
||||
BREAK;
|
||||
case "usun_stanowisko":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update stanowisko SET usun='1' where id_sta='".$_GET['id']."'");
|
||||
if($usun)
|
||||
echo('<center><br><b>Stanowisko zosta³o usuniête</b></center><p>');
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun¹æ stanowiska</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
case "usun_akcje":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update akcja SET usun='1' where id_akc='".$_GET['id']."'");
|
||||
if($usun)
|
||||
echo('<center><br><b>Akcja zosta³o usuniête</b></center><p>');
|
||||
else
|
||||
echo('<center><br><b> Nie mozna by³o usun¹æ akcji</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
case "usun_bank":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update bank SET usun='1' where id_ban='".$_GET['id']."'");
|
||||
if($usun)
|
||||
echo('<center><br><b>Bank zosta³ usuniêty</b></center><p>');
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun¹æ banku</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
case "usun_ubezpieczenia":
|
||||
if(!is_numeric($_GET['id']))
|
||||
uwaga('Brak danych!');
|
||||
else
|
||||
{
|
||||
$usun=mysql_query("update ubezpieczenia SET usun='1' where id_ube='".$_GET['id']."'");
|
||||
if($usun)
|
||||
echo('<center><br><b>Ubezpieczyciel zosta³ usuniêty</b></center><p>');
|
||||
else
|
||||
echo('<center><br><b>Nie mozna by³o usun¹æ ubezpieczyciela</b></center><p>');
|
||||
}
|
||||
BREAK;
|
||||
BREAK;
|
||||
}
|
||||
}
|
||||
if(!isset($_GET['kto']) or ($_GET['kto']!='edytuj_stanowisko'))
|
||||
form_stanowisko();
|
||||
$stanowisko=mysql_query("select id_sta,stanowisko from stanowisko where usun='0' order by stanowisko asc");
|
||||
if(mysql_num_rows($stanowisko)==0)
|
||||
echo('<center><br><b>W bazie nie ma wprowadzonych danych</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista stanowisk</b></center><br>';
|
||||
echo '<center><table width=35%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa stanowiska</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
while($s=mysql_fetch_array($stanowisko))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$s['stanowisko'].'</td><td width=20% align="center"><a class=link href=?co=ustawienia&kto=edytuj_stanowisko&id='.$s['id_sta'].'>Edytuj</a> | <a class=link href=?co=ustawienia&kto=usun_stanowisko&id='.$s['id_sta'].' onclick="return confirm(\'Napewno chcesz usunąć stanowisko?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
|
||||
if(!isset($_GET['kto']) or ($_GET['kto']!='edytuj_akcje'))
|
||||
form_akcja();
|
||||
$akcja=mysql_query("select id_akc,akcja from akcja where usun='0' order by akcja asc");
|
||||
if(mysql_num_rows($akcja)==0)
|
||||
echo('<center><br><b>W bazie nie ma wprowadzonych danych<p></b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista akcji</b></center><br>';
|
||||
echo '<center><table width=35%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa akcji</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
while($a=mysql_fetch_array($akcja))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$a['akcja'].'</td><td width=20% align="center"><a class=link href=?co=ustawienia&kto=edytuj_akcje&id='.$a['id_akc'].'>Edytuj</a> | <a class=link href=?co=ustawienia&kto=usun_akcje&id='.$a['id_akc'].' onclick="return confirm(\'Napewno chcesz usunąć akcje?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
|
||||
if(!isset($_GET['kto']) or ($_GET['kto']!='edytuj_bank'))
|
||||
form_bank();
|
||||
$bank=mysql_query("select id_ban,bank from bank where usun='0' order by bank asc");
|
||||
if(mysql_num_rows($bank)==0)
|
||||
echo('<p><center>W bazie nie ma wprowadzonych danych<p></center>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista banków</b></center><br>';
|
||||
echo '<center><table width=35%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa banku</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
while($b=mysql_fetch_array($bank))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$b['bank'].'</td><td width=20% align="center"><a class=link href=?co=ustawienia&kto=edytuj_bank&id='.$b['id_ban'].'>Edytuj</a> | <a class=link href=?co=ustawienia&kto=usun_bank&id='.$b['id_ban'].' onclick="return confirm(\'Napewno chcesz usunąć bank?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
if(!isset($_GET['kto']) or ($_GET['kto']!='edytuj_ubezpieczenia'))
|
||||
form_ubezpieczenia();
|
||||
$ubez=mysql_query("select id_ube,ubezpieczenia from ubezpieczenia where usun='0' order by ubezpieczenia asc");
|
||||
if(mysql_num_rows($ubez)==0)
|
||||
echo('<center><br><b>W bazie nie ma wprowadzonych danych</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><b>Lista ubezpieczycieli</b></center><br>';
|
||||
echo '<center><table width=35%><tr style="background:#E5E5E5" width=70% align=center><td><b>Nazwa ubezpieczycieli</b></td><td width=30%><b>Opcje</b></td></tr>';
|
||||
while($u=mysql_fetch_array($ubez))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
echo '<tr align=center style="background:'.$color.'"><td align="left"> '.$u['ubezpieczenia'].'</td><td width=20% align="center"><a class=link href=?co=ustawienia&kto=edytuj_ubezpieczenia&id='.$u['id_ube'].'>Edytuj</a> | <a class=link href=?co=ustawienia&kto=usun_ubezpieczenia&id='.$u['id_ube'].' onclick="return confirm(\'Napewno chcesz usunąć ubezpieczyciela?\')">Usun</a></td></tr>';
|
||||
}
|
||||
echo '</table></center><br><br>';
|
||||
}
|
||||
?>
|
||||
3001
vending.php
Normal file
3001
vending.php
Normal file
File diff suppressed because it is too large
Load Diff
79
wydruk_harmonogram.php
Normal file
79
wydruk_harmonogram.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?
|
||||
require('funkcje.php');
|
||||
session_start();
|
||||
lacz_baza();
|
||||
echo '<html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">';
|
||||
echo '<META HTTP-EQUIV="Content-Language" CONTENT="pl"><LINK REL="Stylesheet" HREF="style.css" TYPE="text/css">';
|
||||
$data1=date("Y-m-d");
|
||||
$data2=date("Y-m-d",strtotime("+20 days",time()));
|
||||
$pobierz_userow=mysql_query("select a.id_ham,a.data_ham,a.nrseryjny,a.typ,c.akcja,d.bank,a.nrzlecenia,a.ulica,a.miasto,a.opcja,a.uwagi,a.godzina,b.nazwisko,b.imie,c.akcja,d.bank from harmonogram a,uzytkownicy b,akcja c,bank d where a.id=b.id and a.id_akc=c.id_akc and a.id_ban=d.id_ban and a.usun='0' and a.id='".$_SESSION['id']."' and data_ham >= '".$data1."' and data_ham <= '".$data2."' order by data_ham asc");
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych akcji!!!</b></center><p>');
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '';
|
||||
echo '<table width="311" border="0">
|
||||
<tr>
|
||||
<td width="305" height="183"><img src="images/malcomm.jpg" /> <br />
|
||||
ul. Cieślewskich 25A<br />
|
||||
03-017 Warszawa <br />
|
||||
<p>tel. 022 - 762 05 16 (wewn. 104)<br />
|
||||
fax 022 - 762 05 17<br />
|
||||
<a href="http://www.malcomm.pl/">www.malcomm.pl</a><br />
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>';
|
||||
|
||||
echo '<br><br>';
|
||||
echo '<center><b>Zaplanowane akcje od '.$data1.' do '.$data2.'</b><br></center><br>';
|
||||
echo '<center><table width=95%><tr style="background:#E5E5E5" width=95% align=center><td><b>Data</b></td><td><b>Akcja</b></td><td><b>Bank</b></td><td><b>Nr zlecenia</b></td><td><b>Godzina</b></td><td><b>Nr Seryjny</b></td><td><b>Typ</b></td><td><b>Ulica</b></td><td><b>Miasto</b></td></tr>';
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
{
|
||||
|
||||
$color=zmien_color($color);
|
||||
if($u['opcja']=='0')
|
||||
$color='#FCA1A1';
|
||||
if($u['opcja']=='0')
|
||||
$opcja='<a class=link href=?co=harmonogram&akcja=wykonano&id_ham='.$u['id_ham'].'>NIE</a>';
|
||||
else if($u['opcja']=='1')
|
||||
$opcja='<a class=link href=?co=harmonogram&akcja=niewykonano&id_ham='.$u['id_ham'].'>TAK</a>';
|
||||
$opcje1='<a class=link href=?co=harmonogram&akcja=generuj_raport&id_ham='.$u['id_ham'].' target="_blank">Generuj raport</a>';
|
||||
if($u['godzina']!='00:00:00')
|
||||
{
|
||||
$godzina = date('H:i',strtotime($u['godzina']));
|
||||
}
|
||||
else
|
||||
{
|
||||
$godzina = '---';
|
||||
}
|
||||
if($u['typ']!='')
|
||||
{
|
||||
$typ = $u['typ'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$typ = '---';
|
||||
}
|
||||
if($u['nrseryjny']!='')
|
||||
{
|
||||
$nrseryjny = $u['nrseryjny'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$nrseryjny = '---';
|
||||
}
|
||||
if($u['nrzlecenia']!='')
|
||||
{
|
||||
$nrzlecenia = $u['nrzlecenia'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$nrzlecenia = '---';
|
||||
} echo '<tr style="background-color:'.$color.'"><td style="padding-left:2px; padding-right:2px"><center>'.$u['data_ham'].'</center></td><td><center>'.$u['akcja'].'</center></td><td><center>'.$u['bank'].'</center></td><td><center>'.$nrzlecenia.'</center></td><td><center>'.$godzina.'</center></td><td><center>'.$nrseryjny.'</center></td><td><center>'.$typ.'</center></td><td><center>'.$u['ulica'].'</center></td><td><center>'.$u['miasto'].'</center></td></tr>' ;
|
||||
}
|
||||
echo '<body onLoad="javascript: window.print()">';
|
||||
echo '</table></center>';
|
||||
}
|
||||
?>
|
||||
9
wyloguj.php
Normal file
9
wyloguj.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?
|
||||
session_start();
|
||||
unset($_SESSION['admin']);
|
||||
unset($_SESSION['id']);
|
||||
unset($_SESSION['uprawnienia']);
|
||||
session_destroy();
|
||||
header("location: http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/loguj.php?k=logout");
|
||||
exit();
|
||||
?>
|
||||
1410
zaliczki.php
Normal file
1410
zaliczki.php
Normal file
File diff suppressed because it is too large
Load Diff
12
zaliczki.php.add
Normal file
12
zaliczki.php.add
Normal file
@ -0,0 +1,12 @@
|
||||
<LASTEDITED BY="Tomek"/>
|
||||
<OPTION NAME="WORDWRAP" STATE="ON"/>
|
||||
<OPTION NAME="LINENUMBERS" STATE="ON"/>
|
||||
<OPTION NAME="SHOWALLCHARS" STATE="OFF"/>
|
||||
<OPTION NAME="DIVIDEEDITOR" STATE="SINGLE"/>
|
||||
<OPTION NAME="WYSIWYGMODE" STATE="OFF"/>
|
||||
<LIVESPELL ENABLED="OFF"/>
|
||||
<PARSER NAME="HTML+PHP extended"/>
|
||||
<POSITION LINE="156" CHAR="0"/>
|
||||
<SELECTION START="5995" LENGTH="0"/>
|
||||
<BOOKMARK TYPE="NORMAL" NUMBER="1" LINE="477" COL="0"/>
|
||||
<BOOKMARK TYPE="NORMAL" NUMBER="10" LINE="173" COL="8"/>
|
||||
26
zaliczki_zestawienie.php
Normal file
26
zaliczki_zestawienie.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
function prepareCSV($aData, $sSeparator)
|
||||
{
|
||||
$aCSV = array();
|
||||
|
||||
foreach($aData as $aRow) {
|
||||
$aCSV[] = implode($sSeparator, $aRow);
|
||||
}
|
||||
|
||||
return implode("\n", $aCSV);
|
||||
}
|
||||
$cos1 = 'sdf';
|
||||
$aTransakcje = array(
|
||||
array('Imiê Nazwisko', 'Paliwo', 'Noclegi', 'Inne', 'Suma'),
|
||||
array($cos1, 'TV', 1200),
|
||||
array(2, 'Zegarek', 90),
|
||||
array(5, 'Fotel', 240)
|
||||
);
|
||||
|
||||
header("Content-Type: application/xls; charset=utf-8");
|
||||
header("Content-disposition: attachment; filename=".Zestawienie_wydatkow.".xls");
|
||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||
header('Pragma: public');
|
||||
|
||||
echo prepareCSV($aTransakcje, "\t");
|
||||
?>
|
||||
6
zestawienia.php
Normal file
6
zestawienia.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?
|
||||
form_zestawienie_zaliczek();
|
||||
form_zestawienie_km();
|
||||
form_zestawienie_paliwo();
|
||||
form_zestawienie_czasu();
|
||||
?>
|
||||
47
zestawienie_czas_raport.php
Normal file
47
zestawienie_czas_raport.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
//Zestawienie czas
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT temp1 as Data,temp2 as Imie,temp3 as Nazwisko, temp4 as Czas_dojazdu, temp5 as Czas_przy_bankomacie ,temp6 as Czas_powrotu
|
||||
FROM temp
|
||||
ORDER BY data ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value)) OR ($value == "")) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"','', $value);
|
||||
$value = $value . ';';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=Zestawienie_czasu_" . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
104
zestawienie_czasu.php
Normal file
104
zestawienie_czasu.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?
|
||||
if (($_POST['data1']==0) OR ($_POST['data2']==0))
|
||||
{
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Nie okre¶lono zakresu dat - spróbuj ponownie...</b><br><br></td></tr></table></center>';
|
||||
form_zestawienie_czasu();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_POST['id']==0)
|
||||
{
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Nie wybrano technika - spróbuj ponownie...</b><br><br></td></tr></table></center>';
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
$sql = mysql_query("TRUNCATE temp_czas");
|
||||
$pobierz_userow=mysql_query("SELECT a.data as data , b.id AS id, b.nazwisko AS nazwisko, b.imie AS imie, a.godzroz, a.godzprzy
|
||||
FROM raporty a, uzytkownicy b
|
||||
WHERE a.id = b.id
|
||||
AND a.data >= '2009-05-01'
|
||||
AND a.data <= '2009-05-30'
|
||||
AND a.id = '14'
|
||||
GROUP BY a.data
|
||||
LIMIT 0 , 30");
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
{
|
||||
$id_user = $u[id];
|
||||
$data = $u[data];
|
||||
$nazwisko = $u[nazwisko];
|
||||
$imie = $u[imie];
|
||||
$roznica1= strtotime('01.01.1970 ' . $u['godzprzy']);
|
||||
//$roznica1 = ($u[godzprzy] - $u[godzroz]);
|
||||
$temp = mysql_query("INSERT INTO `temp_czas` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6`, `temp7` )
|
||||
VALUES (
|
||||
'$id_user', '$data','$nazwisko', '$imie', '$roznica1', '0', '0'
|
||||
)");
|
||||
}
|
||||
$pobierz_userow2=mysql_query("select a.data,a.id,b.id,a.godzroz from raporty a,uzytkownicy b where a.id=b.id and a.data >= '".$_POST['data1']."' and a.data <= '".$_POST['data2']."' and a.id='{$u['id']}' group by a.data");
|
||||
while($z=mysql_fetch_array($pobierz_userow2))
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$imie = $z[imie];
|
||||
/*$temp = mysql_query("INSERT INTO `temp_czas` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` )
|
||||
VALUES (
|
||||
'$id_user', '$nazwisko', '$imie', '0', '0', '0'
|
||||
)");
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
$sql = mysql_query("TRUNCATE temp");
|
||||
|
||||
|
||||
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Zestawienie czasu pracy od '.$data1.' do '.$data2.'</b><br><br></td></tr></table></center>';
|
||||
$uzytkownicy = mysql_query("SELECT id,imie,nazwisko FROM uzytkownicy where id='".$_POST['id']."' group by nazwisko");
|
||||
$color=$color1;
|
||||
while ($u = mysql_fetch_array($uzytkownicy))
|
||||
{
|
||||
echo '<center><table width=60%>technik: <b>'.$u['nazwisko'].' '.$u['imie'].'</b></table></center>';
|
||||
echo '<br>';
|
||||
$color=zmien_color($color);
|
||||
echo '<center><table width=60%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>Nr zlecenia</b></td><td><b>Czas dojazdu</b></td><td><b>Czas przy bankomacie</b></td><td><b>Czas powrotu</b></td>';
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,a.nrzlecenia,a.godzzak,a.id_rap,a.godzroz,a.data,SUBTIME(godzzak, godzroz) as przy_bankomacie,SUBTIME(godzroz, godzwyj) as poza1,SUBTIME(godzprzy, godzzak) as poza2 from raporty a,uzytkownicy b where a.id=b.id and a.data >= '".$_POST['data1']."' and a.data <= '".$_POST['data2']."'and a.id='{$u['id']}' group by a.id_rap order by a.data");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
|
||||
while($x = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
if ($x['przy_bankomacie']=='00:00:00')
|
||||
{
|
||||
echo '<center><tr style="background-color:'.$color1.'" width=70% align=center><td><center>'.$x['data'].'</td></center><td></center><a href="panel.php?co=raporty&akcja=pokaz&id_rap='.$x['id_rap'].'" target="_blank">'.$x['nrzlecenia'].'</a></center></td><td>'.($x['poza1']).'</center></td><td>'.($x['przy_bankomacie']).'</center></td><td>'.($x['poza2']).'</center></td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$data = $x['data'];
|
||||
$imie = $x['imie'];
|
||||
$nazwisko = $x['nazwisko'];
|
||||
$czas_dojazdu = $x['poza1'];
|
||||
$przy_bankomacie = $x['przy_bankomacie'];
|
||||
$czas_powrotu = $x['poza2'];
|
||||
|
||||
$temp = mysql_query("INSERT INTO `temp` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` )
|
||||
VALUES (
|
||||
'$data', '$imie', '$nazwisko', '$czas_dojazdu', '$przy_bankomacie', '$czas_powrotu'
|
||||
)");
|
||||
|
||||
echo '<center><tr style="background-color:'.$color.'" width=70% align=center><td><center>'.$x['data'].'</td></center><td></center><a href="panel.php?co=raporty&akcja=pokaz&id_rap='.$x['id_rap'].'" target="_blank">'.$x['nrzlecenia'].'</a></center></td><td>'.($x['poza1']).'</center></td><td>'.($x['przy_bankomacie']).'</center></td><td>'.($x['poza2']).'</center></td>';
|
||||
}
|
||||
}
|
||||
echo '<center><table width=60%><tr width=70% align=center><td></td></tr>';
|
||||
echo '<br><center><table width=60%><tr align=left><a class=menu2 href="http://www.malcomm.pl/online/zestawienie_czas_raport.php">Eksport do Excel`a</a></tr></table></center>';
|
||||
echo '</table></center>';
|
||||
$przy_bankomacie = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
130
zestawienie_klometrow.php
Normal file
130
zestawienie_klometrow.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?
|
||||
if ($_POST['id']==0)
|
||||
{
|
||||
$sql = mysql_query("TRUNCATE temp_kilometry");
|
||||
$pobierz_userow=mysql_query("select id,imie,nazwisko from uzytkownicy where usun='0' and id_sta='3' and usun='0' and blok='NIE' group by nazwisko");
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
{
|
||||
$id_user = $u[id];
|
||||
$nazwisko = $u[nazwisko];
|
||||
$imie = $u[imie];
|
||||
$temp = mysql_query("INSERT INTO `temp_kilometry` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` )
|
||||
VALUES (
|
||||
'$id_user', '$nazwisko', '$imie', '0', '0', '0'
|
||||
)");
|
||||
}
|
||||
$pobierz_userow2=mysql_query("select b.temp1 as id,sum(a.przejechano) as kilometry from kilometry a,temp_kilometry b where a.id=b.temp1 and a.usun='0' and a.wyjazd='0' and a.data_kil >= '".$_POST['data1']."' and a.data_kil <= '".$_POST['data2']."' group by b.temp2");
|
||||
while($z=mysql_fetch_array($pobierz_userow2))
|
||||
{
|
||||
$id1 = $z[id];
|
||||
$sluzbowe = $z[kilometry];
|
||||
$temp = mysql_query("update temp_kilometry SET temp4='".$sluzbowe."' where temp1='".$id1."'");
|
||||
$sluzbowe = '0';
|
||||
}
|
||||
$pobierz_userow3=mysql_query("select b.temp1 as id,sum(a.przejechano) as kilometry from kilometry a,temp_kilometry b where a.id=b.temp1 and a.usun='0' and a.wyjazd='1' and a.data_kil >= '".$_POST['data1']."' and a.data_kil <= '".$_POST['data2']."' group by b.temp2");
|
||||
while($y=mysql_fetch_array($pobierz_userow3))
|
||||
{
|
||||
$id2 = $y[id];
|
||||
$sluzbowe2 = $y[kilometry];
|
||||
$temp = mysql_query("update temp_kilometry SET temp5='".$sluzbowe2."' where temp1='".$id2."'");
|
||||
$sluzbowe = '0';
|
||||
}
|
||||
$pobierz_userow4=mysql_query("select b.temp1 as id,sum(a.przejechano) as kilometry from kilometry a,temp_kilometry b where a.id=b.temp1 and a.usun='0' and a.data_kil >= '".$_POST['data1']."' and a.data_kil <= '".$_POST['data2']."' group by b.temp2");
|
||||
while($x=mysql_fetch_array($pobierz_userow4))
|
||||
{
|
||||
$id3 = $x[id];
|
||||
$sluzbowe3 = $x[kilometry];
|
||||
$temp = mysql_query("update temp_kilometry SET temp6='".$sluzbowe3."' where temp1='".$id3."'");
|
||||
$sluzbowe = '0';
|
||||
}
|
||||
|
||||
|
||||
$pobierz_userow5=mysql_query("select * from temp_kilometry group by temp2");
|
||||
$data1 = $_POST['data1'];
|
||||
$data2 = $_POST['data2'];
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
{
|
||||
uwaga('<center><table><tr><td colspan=2 align=center><br><b>Nie okre¶lono zakresu dat - spróbuj ponownie...</b><br><br></td></tr></table></center>');
|
||||
form_zestawienie_km();
|
||||
}
|
||||
else
|
||||
{
|
||||
$color=$color1;
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Zestawienie kilometrow od '.$data1.' do '.$data2.'</b><br><br></td></tr></table></center>';
|
||||
echo '<center><table width=45%><tr style="background:#E5E5E5" width=70% align=center><td><b>Imie Nazwisko</b></td><td><b>S³u¿obowe</b></td><td><b>Prywatne</b></td><td><b>Suma</b></td></td></tr>';
|
||||
while($a=mysql_fetch_array($pobierz_userow5))
|
||||
{
|
||||
$roznica = ($z['kilometry'] - $u['kilometry']);
|
||||
|
||||
$color=zmien_color($color);
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$a['temp2'].' '.$a['temp3'].'</center></td><td><center>'.$a['temp4'].' km</td><td><center>'.$a['temp5'].' km</td><td><center>'.$a['temp6'].' km</td></center></tr>' ;
|
||||
$nazwisko = $a[temp2];
|
||||
$imie = $a[temp3];
|
||||
$sluzbowe = $a[temp4];
|
||||
$prywatne = $a[temp5];
|
||||
$suma = $a[temp6];
|
||||
$sql2 = mysql_query("INSERT INTO `temp` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` , `trmp7` , `tmp8` )
|
||||
VALUES (
|
||||
'$nazwisko', '$imie', '$sluzbowe', '$prywatne', '$suma', '', '', ''
|
||||
)");
|
||||
}
|
||||
echo '</table></center>';
|
||||
echo '<br><center><table width=45%><tr align=left><a class=menu2 href="http://www.malcomm.pl/online/zestawienie_klometry_raport2.php">Eksport do Excel`a</a></tr></table></center>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$pobierz_userow3=mysql_query("select b.id,b.imie,b.nazwisko,sum(a.przejechano) as kilometry from kilometry a,uzytkownicy b where a.id=b.id and a.usun='0' and a.wyjazd='0' and a.data_kil >= '".$_POST['data1']."' and a.data_kil <= '".$_POST['data2']."' and b.id='".$_POST['id']."'");
|
||||
$pobierz_userow4=mysql_query("select b.id,b.imie,b.nazwisko,sum(a.przejechano) as kilometry from kilometry a,uzytkownicy b where a.id=b.id and a.usun='0' and a.data_kil >= '".$_POST['data1']."' and a.data_kil <= '".$_POST['data2']."' and b.id='".$_POST['id']."'");
|
||||
$data1 = $_POST['data1'];
|
||||
$data2 = $_POST['data2'];
|
||||
if(mysql_num_rows($pobierz_userow3)==0)
|
||||
{
|
||||
uwaga('<center><table><tr><td colspan=2 align=center><br><b>Nie okre¶lono zakresu dat - spróbuj ponownie...</b><br><br></td></tr></table></center>');
|
||||
form_zestawienie_km();
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = mysql_query("TRUNCATE temp");
|
||||
$color=$color1;
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Zestawienie kilometrow od '.$data1.' do '.$data2.'</b><br><br></td></tr></table></center>';
|
||||
echo '<center><table width=45%><tr style="background:#E5E5E5" width=70% align=center><td><b>Imie Nazwisko</b></td><td><b>S³u¿obowe</b></td><td><b>Prywatne</b></td><td><b>Suma</b></td></td></tr>';
|
||||
while($x=mysql_fetch_array($pobierz_userow3) and $y=mysql_fetch_array($pobierz_userow4))
|
||||
{
|
||||
$roznica = ($y['kilometry'] - $x['kilometry']);
|
||||
$s1 = $x['kilometry'];
|
||||
if ($s1=='')
|
||||
$s2 = "0";
|
||||
else
|
||||
$s2 = $s1;
|
||||
|
||||
$s3 = $y['kilometry'];
|
||||
if ($s3=='')
|
||||
$s4 = "0";
|
||||
else
|
||||
$s4 = $s3;
|
||||
$color=zmien_color($color);
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$x['nazwisko'].' '.$x['imie'].'</center></td><td><center>'.$s2.' km</td><td><center>'.$roznica.' km</td><td><center>'.$s4.' km</td></center></tr>' ;
|
||||
$nazwisko = $x[nazwisko];
|
||||
$imie = $x[imie];
|
||||
|
||||
if ($x['kilometry']=='')
|
||||
$sluzbowe = '0';
|
||||
else
|
||||
$sluzbowe = $x['kilometry'];
|
||||
|
||||
$prywatne = $roznica;
|
||||
$suma = $y['kilometry'];
|
||||
$sql2 = mysql_query("INSERT INTO `temp` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` , `trmp7` , `tmp8` )
|
||||
VALUES (
|
||||
'$nazwisko', '$imie', '$sluzbowe', '$prywatne', '$suma', '', '', ''
|
||||
)");
|
||||
}
|
||||
echo '</table></center>';
|
||||
echo '<br><center><table width=45%><tr align=left><a class=menu2 href="http://www.malcomm.pl/online/zestawienie_klometry_raport.php">Eksport do Excel`a</a></tr></table></center>';
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
47
zestawienie_klometry_raport.php
Normal file
47
zestawienie_klometry_raport.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
//Zestawienie zaliczek
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT temp1 as Nazwisko,temp2 as Imie,temp3 as S³u¿bowe, temp4 as Prywatne, temp5 as Suma
|
||||
FROM temp
|
||||
ORDER BY nazwisko ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value)) OR ($value == "")) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=Zestawienie_kilometrow_" . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
46
zestawienie_klometry_raport2.php
Normal file
46
zestawienie_klometry_raport2.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
//Zestawienie zaliczek
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT temp2 as Nazwisko,temp3 as Imie,temp4 as S³u¿bowe, temp5 as Prywatne, temp6 as Suma
|
||||
FROM temp_kilometry ORDER BY nazwisko ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value)) OR ($value == "")) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=Zestawienie_kilometrow_" . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
68
zestawienie_paliwo.php
Normal file
68
zestawienie_paliwo.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
// pobieranie userów
|
||||
|
||||
$data=date("Y-m-d",strtotime("-0 days",time()));
|
||||
|
||||
$data2=date("Y-m-d",strtotime("-30 days",time()));
|
||||
|
||||
$pobierz_userow=mysql_query("select a.wyjazd,a.id_tan,a.data_tan,b.nazwisko,b.imie,c.auto,a.stankm,a.litry from tankowania a,uzytkownicy b,samochody c where a.id=b.id and a.id_sam=c.id_sam and a.usun='0' and a.id_sam='".$_POST['id_sam']."' and a.data_tan>= '".$_POST['data1']."' and a.data_tan<= '".$_POST['data2']."' order by data_tan desc");
|
||||
|
||||
if(mysql_num_rows($pobierz_userow)==0)
|
||||
|
||||
uwaga('<center><br><b>W bazie nie ma wprowadzonych ¿adnych danych!!!</b></center><p>');
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
form_szukaj_tankowania();
|
||||
|
||||
|
||||
|
||||
$color=$color1;
|
||||
|
||||
echo '<center><table width=75%><tr style="background:#E5E5E5" width=70% align=center><td><b>Data</b></td><td><b>U¿ytkownik</b></td><td><b>Auto</b></td><td><b>StanKm</b></td><td><b>Litry</b></td><td><b>Wyjazd</b></td><td><b>Opcje</b></td></tr>';
|
||||
|
||||
while($u=mysql_fetch_array($pobierz_userow))
|
||||
|
||||
{
|
||||
|
||||
if($u['wyjazd']=='0') $trasa='S³u¿bowy'; else { $trasa= 'Prywatny';}
|
||||
|
||||
$color=zmien_color($color);
|
||||
|
||||
if($u['blok']=='TAK')
|
||||
|
||||
$color='red';
|
||||
$li=$li+1;
|
||||
$opcje1='<a class=link href=?co=tankowania&akcja=pokaz&id_tan='.$u['id_tan'].' target="_blank" >Poka¿</a> | ';
|
||||
|
||||
$opcje2='<a class=link href=?co=tankowania&akcja=edytuj&id_tan='.$u['id_tan'].'>Edytuj</a>';
|
||||
|
||||
echo '<tr style="background-color:'.$color.'"><td style="padding-left:10px; padding-right:10px"><center>'.$u['data_tan'].'</center></td><td><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td><td><center>'.$u['auto'].'</center></td><td><center>'.$u['stankm'].'</center></td><td><center>'.$u['litry'].'</center></td><td><center>'.$trasa.'</center></td><td><center>'.$opcje1.''.$opcje2.'</center></td></tr>' ;
|
||||
|
||||
$pierwszy[$li]=$u['stankm'];
|
||||
$ostatni[$li]=$u['stankm'];
|
||||
$sumapaliwa=$sumapaliwa+$u['litry'];
|
||||
|
||||
}
|
||||
|
||||
echo '</table></center>';
|
||||
|
||||
} $sumakilometrow=$pierwszy[1]-$ostatni[$li];
|
||||
echo '<BR>';
|
||||
echo 'Suma zatankowanego paliwa: ' .$sumapaliwa;
|
||||
echo '<BR>';
|
||||
echo 'Ilosc przejechanych kilometrow: ' .$sumakilometrow;
|
||||
|
||||
$sredniespalanie=($sumapaliwa*100)/$sumakilometrow;
|
||||
|
||||
echo '<BR>';
|
||||
echo 'Srednie spalanie: ' .round($sredniespalanie, 2);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
162
zestawienie_zaliczek.php
Normal file
162
zestawienie_zaliczek.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?
|
||||
if (($_POST['data1']==0) OR ($_POST['data2']==0))
|
||||
{
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Nie okre¶lono zakresu dat - spróbuj ponownie...</b><br><br></td></tr></table></center>';
|
||||
form_zestawienie_zaliczek();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($_POST['id']==0)
|
||||
{
|
||||
//wiele
|
||||
$sql = mysql_query("TRUNCATE temp");
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Zestawienie wydatków od '.$data1.' do '.$data2.'</b><br><br></td></tr></table></center>';
|
||||
$uzytkownicy = mysql_query("SELECT id,imie,nazwisko FROM uzytkownicy where id_sta='3' and blok='NIE' group by nazwisko");
|
||||
$color=$color1;
|
||||
echo '<center><table width=60%><tr style="background:#E5E5E5" width=70% align=center><td width=18%><b>Imie Nazwisko</b></td><td ><b>Paliwo</b></td><td width=18%><b>Noclegi</b></td><td><b>Inne</b></td><td><b>Suma</b></td></td></tr></table></center>';
|
||||
|
||||
while ($u = mysql_fetch_array($uzytkownicy))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
|
||||
echo '<center><table width=60%><tr style="background-color:'.$color.'" width=70% align=center><td width=18%><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td>';
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,sum(a.wydano) as wydatki from zaliczki a,uzytkownicy b where a.id=b.id and a.data_zal >= '".$_POST['data1']."' and a.data_zal <= '".$_POST['data2']."' and a.id_wyd = '1' and a.usun='0' and a.id='{$u['id']}' group by b.nazwisko");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
while($x = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
$suma1 = $x['wydatki'];
|
||||
echo '<td width=18%><center>'.$x['wydatki'].' PLN</center></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$suma1 = '0';
|
||||
echo '<td width=18%><center>'.$suma1.' PLN</center></td>';
|
||||
}
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,sum(a.wydano) as wydatki from zaliczki a,uzytkownicy b where a.id=b.id and a.data_zal >= '".$_POST['data1']."' and a.data_zal <= '".$_POST['data2']."' and a.id_wyd = '2' and a.usun='0' and a.id='{$u['id']}' group by b.nazwisko");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
while($y = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
$suma2 = $y['wydatki'];
|
||||
echo '<td width=18%><center>'.$y['wydatki'].' PLN</center></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$suma2 = '0';
|
||||
echo '<td width=18%><center>'.$suma2.' PLN</center></td>';
|
||||
}
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,sum(a.wydano) as wydatki from zaliczki a,uzytkownicy b where a.id=b.id and a.data_zal >= '".$_POST['data1']."' and a.data_zal <= '".$_POST['data2']."' and a.id_wyd = '3' and a.usun='0' and a.id='{$u['id']}' group by b.nazwisko");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
while($z = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
$suma3 = $z['wydatki'];
|
||||
echo '<td width=18%><center>'.$z['wydatki'].' PLN</center></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$suma3 = '0';
|
||||
echo '<td width=18%><center>'.$suma3.' PLN</center></td>';
|
||||
}
|
||||
$suma = $suma1 + $suma2 + $suma3;
|
||||
$s = sprintf("%.2f", $suma);
|
||||
echo '<td width=18%><center>'.$s.' PLN</center></td>';
|
||||
$nazwisko = $u['nazwisko'];
|
||||
$imie = $u['imie'];
|
||||
$sql2 = mysql_query("INSERT INTO `temp` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` , `trmp7` , `tmp8` )
|
||||
VALUES (
|
||||
'$nazwisko', '$imie', '$suma1', '$suma2', '$suma3', '$s', '', ''
|
||||
)");
|
||||
$suma1 = 0;
|
||||
$suma2 = 0;
|
||||
$suma3 = 0;
|
||||
}
|
||||
echo '</table></center>';
|
||||
echo '<br><center><table width=60%><tr align=left><a class=menu2 href="http://www.malcomm.pl/online/zestawienie_zaliczek_raport.php">Eksport do Excel`a</a></tr></table></center>';
|
||||
}
|
||||
//
|
||||
else
|
||||
{
|
||||
//jeden
|
||||
$sql = mysql_query("TRUNCATE temp");
|
||||
echo '<center><table><tr><td colspan=2 align=center><br><b>Zestawienie wydatków od '.$data1.' do '.$data2.'</b><br><br></td></tr></table></center>';
|
||||
$uzytkownicy = mysql_query("SELECT id,imie,nazwisko FROM uzytkownicy where id='".$_POST['id']."' group by nazwisko");
|
||||
$color=$color1;
|
||||
echo '<center><table width=60%><tr style="background:#E5E5E5" width=70% align=center><td width=18%><b>Imie Nazwisko</b></td><td ><b>Paliwo</b></td><td width=18%><b>Noclegi</b></td><td><b>Inne</b></td><td><b>Suma</b></td></td></tr></table></center>';
|
||||
|
||||
while ($u = mysql_fetch_array($uzytkownicy))
|
||||
{
|
||||
$color=zmien_color($color);
|
||||
|
||||
echo '<center><table width=60%><tr style="background-color:'.$color.'" width=70% align=center><td width=18%><center>'.$u['nazwisko'].' '.$u['imie'].'</center></td>';
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,sum(a.wydano) as wydatki from zaliczki a,uzytkownicy b where a.id=b.id and a.data_zal >= '".$_POST['data1']."' and a.data_zal <= '".$_POST['data2']."' and a.id_wyd = '1' and a.usun='0' and a.id='{$u['id']}' group by b.nazwisko");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
while($x = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
$suma1 = $x['wydatki'];
|
||||
echo '<td width=18%><center>'.$x['wydatki'].' PLN</center></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$suma1 = '0';
|
||||
echo '<td width=18%><center>'.$suma1.' PLM</center></td>';
|
||||
}
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,sum(a.wydano) as wydatki from zaliczki a,uzytkownicy b where a.id=b.id and a.data_zal >= '".$_POST['data1']."' and a.data_zal <= '".$_POST['data2']."' and a.id_wyd = '2' and a.usun='0' and a.id='{$u['id']}' group by b.nazwisko");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
while($y = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
$suma2 = $y['wydatki'];
|
||||
echo '<td width=18%><center>'.$y['wydatki'].' PLN</center></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$suma2 = '0';
|
||||
echo '<td width=18%><center>'.$suma2.' PLN</center></td>';
|
||||
}
|
||||
$zlecenia = mysql_query("select b.imie,b.nazwisko,sum(a.wydano) as wydatki from zaliczki a,uzytkownicy b where a.id=b.id and a.data_zal >= '".$_POST['data1']."' and a.data_zal <= '".$_POST['data2']."' and a.id_wyd = '3' and a.usun='0' and a.id='{$u['id']}' group by b.nazwisko");
|
||||
$ile = mysql_num_rows($zlecenia);
|
||||
if ($ile)
|
||||
{
|
||||
while($z = mysql_fetch_array($zlecenia))
|
||||
{
|
||||
$suma3 = $z['wydatki'];
|
||||
echo '<td width=18%><center>'.$z['wydatki'].' PLN</center></td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$suma3 = '0';
|
||||
echo '<td width=18%><center>'.$suma3.' PLN</center></td>';
|
||||
}
|
||||
$suma = $suma1 + $suma2 + $suma3;
|
||||
$s = sprintf("%.2f", $suma);
|
||||
echo '<td width=18%><center>'.$s.' PLN</center></td>';
|
||||
$nazwisko = $u['nazwisko'];
|
||||
$imie = $u['imie'];
|
||||
$sql2 = mysql_query("INSERT INTO `temp` ( `temp1` , `temp2` , `temp3` , `temp4` , `temp5` , `temp6` , `trmp7` , `tmp8` )
|
||||
VALUES (
|
||||
'$nazwisko', '$imie', '$suma1', '$suma2', '$suma3', '$s', '', ''
|
||||
)");
|
||||
$suma1 = 0;
|
||||
$suma2 = 0;
|
||||
$suma3 = 0;
|
||||
echo '</table></center>';
|
||||
}
|
||||
echo '<br><center><table width=60%><tr align=left><a class=menu2 href="http://www.malcomm.pl/online/zestawienie_zaliczek_raport.php">Eksport do Excel`a</a></tr></table></center>';
|
||||
}
|
||||
}
|
||||
//
|
||||
?>
|
||||
47
zestawienie_zaliczek_raport.php
Normal file
47
zestawienie_zaliczek_raport.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
//Zestawienie zaliczek
|
||||
|
||||
$connect = mysql_connect("sql.atm.home.pl","atm3","alan87") or die ("Nie mozna polaczyc sie z serwerem");
|
||||
$db = mysql_select_db("atm3", $connect) or die ("Nie mozna wybrac nbazy danych");
|
||||
$select = "SELECT temp1 as Nazwisko,temp2 as Imie,temp3 as Paliwo, temp4 as Noclegi, temp5 as Inne, temp6 as Suma
|
||||
FROM temp
|
||||
ORDER BY nazwisko ASC";
|
||||
|
||||
$export = mysql_query($select);
|
||||
$fields = mysql_num_fields($export);
|
||||
|
||||
|
||||
|
||||
for ($i = 0; $i < $fields; $i++) {
|
||||
$header .= mysql_field_name($export, $i) . "; ";
|
||||
}
|
||||
|
||||
|
||||
while($row = mysql_fetch_row($export)) {
|
||||
$line = '';
|
||||
foreach($row as $value) {
|
||||
if ((!isset($value)) OR ($value == "")) {
|
||||
$value = "\t";
|
||||
} else {
|
||||
$value = str_replace('"', '', $value);
|
||||
$value = $value . '; ';
|
||||
}
|
||||
$line .= $value;
|
||||
}
|
||||
$data .= trim($line)."\n";
|
||||
}
|
||||
$data = str_replace("\r","",$data);
|
||||
|
||||
if ($data == "") {
|
||||
$data = "\nNie okreœlono daty!\n";
|
||||
}
|
||||
|
||||
|
||||
header("Content-type: text/csv");
|
||||
header("Content-disposition: attachment; filename=Zestawienie_zaliczek_" . date("Y-m-d").".csv");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
print "$header\n$data";
|
||||
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user