forked from PhilDaintree/CounterLogicPOS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Z_POS_Data.php
executable file
·83 lines (67 loc) · 3.24 KB
/
Z_POS_Data.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
include('includes/GetPrice.inc');
/* $Id: Z_POS_Data.php 3843 2010-09-30 14:49:45Z daintree $*/
$PageSecurity = 9;
/* Note: For really large databases need to change config.php MaxExecutionTime = 1000; or similar */
include('includes/session.php');
$Title = _('Create POS Data Upload File');
include('includes/header.php');
if (isset($_GET['Delete'])){
unlink($_SESSION['reports_dir'] . '/POS.sql');
unlink($_SESSION['reports_dir'] . '/POS.sql.zip');
prnMsg(_('Old POS upload files deleted'),'info');
}
if (!isset($_GET['POSDebtorNo']) AND !isset($_GET['POSBranchCode'])){
echo '<p class="page_title_text"><img src="'. $RootPath.'/css/'. $Theme.'/images/maintenance.png" title="' . _('Create POS Data File') . '" alt="">' . ' ' . $Title.'<br />';
echo "<form method='post' action=" . $_SERVER['PHP_SELF'] . '><br>';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
//Need to get POS customer as need to know currency for prices and the sale type for prices
if (!isset($_POST['POSDebtorNo'])){
$_POST['POSDebtorNo']='';
}
if (!isset($_POST['POSBranchCode'])){
$_POST['POSBranchCode']='';
}
echo '<table class="selection">
<tr>
<td>' . _('POS Customer Code') . ':</td>
<td><input tabindex="1" type="text" name="POSDebtorNo" value="' . $_POST['POSDebtorNo'] . '" size="12" maxlength="12" /></td>
</tr>
<tr>
<td>' . _('POS Branch Code') . ':</td>
<td><input tabindex="2" type="text" name="POSBranchCode" value="' . $_POST['POSBranchCode'] .'" size="12" maxlength="12" /></td>
</tr>';
echo '<tr><td colspan=2><div class="centre"><input tabindex="3" type="Submit" name="CreatePOSDataFile" value=' . _('Create POS Data File') .'></div></td></tr>';
echo '</table></form>';
} else {
$_POST['POSDebtorNo'] = $_GET['POSDebtorNo'];
$_POST['POSBranchCode'] = $_GET['POSBranchCode'];
$_POST['CreatePOSDataFile'] = 'Yes Please';
}
if (isset($_POST['CreatePOSDataFile'])){
$InputError =0;
if (!isset($_POST['POSDebtorNo']) OR $_POST['POSDebtorNo'] == ''){
prnMsg(_('Cannot create POS Data file without the POS Customer Code'),'error');
$InputError =1;
} elseif(!isset($_POST['POSBranchCode']) OR $_POST['POSBranchCode']==''){
prnMsg(_('Cannot create POS Data file without the POS Customer Branch Code'),'error');
$InputError =1;
}
if ($InputError ==0) {
include('includes/Z_POSDataCreation.php');
$ResultOfCreateFunction = Create_POS_Data_Full($_POST['POSDebtorNo'],$_POST['POSBranchCode'],'./', $db);
if ( $ResultOfCreateFunction == 1 ){
echo '<br />
<br />
<a href="' . $_SESSION['reports_dir'] . '/POS.sql.zip">' . _('Download POS Upload File') . '</a>';
} else {
prnMsg(_('Unable to create POS Data file. The POS file creation fuction returned' . ' ' . $ResultOfCreateFunction),'error');
}
} // end if no input errors
} //hit create POSDataFile
if (file_exists($_SESSION['reports_dir'] . '/POS.sql.zip')){
prnMsg(_('It is important to delete the POS Data file after it has been retrieved - use the link below to delete it'),'warn');
echo '<p><a href="' . $_SERVER['PHP_SELF'] . '?Delete=Yes">' . _('Delete the POS Upload File') . '</a></p>';
}
include('includes/footer.php');
?>