|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -/* $Id$*/ |
| 3 | +/* $Id: StockMovements.php 7957 2018-02-12 21:53:28Z turbopt $*/ |
4 | 4 |
|
5 | 5 | include('includes/session.php');
|
6 | 6 | $Title = _('Stock Movements');
|
|
34 | 34 | <div>
|
35 | 35 | <input type="hidden" name="FormID" value="', $_SESSION['FormID'], '" />';
|
36 | 36 |
|
37 |
| -if (!isset($_POST['BeforeDate']) OR !Is_Date($_POST['BeforeDate'])){ |
| 37 | +if (!isset($_POST['BeforeDate']) OR !Is_date($_POST['BeforeDate'])){ |
38 | 38 | $_POST['BeforeDate'] = Date($_SESSION['DefaultDateFormat']);
|
39 | 39 | }
|
40 |
| -if (!isset($_POST['AfterDate']) OR !Is_Date($_POST['AfterDate'])){ |
| 40 | +if (!isset($_POST['AfterDate']) OR !Is_date($_POST['AfterDate'])){ |
41 | 41 | $_POST['AfterDate'] = Date($_SESSION['DefaultDateFormat'], Mktime(0,0,0,Date('m')-3,Date('d'),Date('y')));
|
42 | 42 | }
|
43 | 43 |
|
|
57 | 57 | AND locationusers.canview=1
|
58 | 58 | ORDER BY locationname";
|
59 | 59 |
|
60 |
| -$resultStkLocs = DB_query($sql); |
| 60 | +$resultStkLocs = DB_query($SQL); |
61 | 61 |
|
62 | 62 | while ($myrow=DB_fetch_array($resultStkLocs)){
|
63 | 63 | if (isset($_POST['StockLocation']) AND $_POST['StockLocation']!='All'){
|
64 | 64 | if ($myrow['loccode'] == $_POST['StockLocation']){
|
65 |
| - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
| 65 | + echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
66 | 66 | } else {
|
67 |
| - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
| 67 | + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
68 | 68 | }
|
69 | 69 | } elseif ($myrow['loccode']==$_SESSION['UserStockLocation']){
|
70 |
| - echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
71 |
| - $_POST['StockLocation']=$myrow['loccode']; |
| 70 | + echo '<option selected="selected" value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
| 71 | + $_POST['StockLocation']=$myrow['loccode']; |
72 | 72 | } else {
|
73 |
| - echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
| 73 | + echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>'; |
74 | 74 | }
|
75 | 75 | }
|
76 | 76 |
|
|
87 | 87 | $SQLBeforeDate = FormatDateForSQL($_POST['BeforeDate']);
|
88 | 88 | $SQLAfterDate = FormatDateForSQL($_POST['AfterDate']);
|
89 | 89 |
|
90 |
| -$sql = "SELECT stockmoves.stockid, |
| 90 | +$SQL = "SELECT stockmoves.stockid, |
91 | 91 | systypes.typename,
|
92 | 92 | stockmoves.stkmoveno,
|
93 | 93 | stockmoves.type,
|
|
111 | 111 | ON stockmoves.stockid=stockmaster.stockid
|
112 | 112 | WHERE stockmoves.loccode='" . $_POST['StockLocation'] . "'
|
113 | 113 | AND stockmoves.trandate >= '" . $SQLAfterDate . "'
|
114 |
| - AND stockmoves.stockid = '" . $StockID . "' |
115 |
| - AND stockmoves.trandate <= '" . $SQLBeforeDate . "' |
116 |
| - AND hidemovt=0 |
| 114 | + AND stockmoves.stockid = '" . $StockID . "' |
| 115 | + AND stockmoves.trandate <= '" . $SQLBeforeDate . "' |
| 116 | + AND hidemovt=0 |
117 | 117 | ORDER BY stkmoveno DESC";
|
118 | 118 |
|
119 | 119 | $ErrMsg = _('The stock movements for the selected criteria could not be retrieved because') . ' - ';
|
120 | 120 | $DbgMsg = _('The SQL that failed was') . ' ';
|
121 | 121 |
|
122 |
| -$MovtsResult = DB_query($sql, $ErrMsg, $DbgMsg); |
| 122 | +$MovtsResult = DB_query($SQL, $ErrMsg, $DbgMsg); |
123 | 123 |
|
124 | 124 | if (DB_num_rows($MovtsResult) > 0) {
|
125 | 125 | $myrow = DB_fetch_array($MovtsResult);
|
126 | 126 |
|
127 | 127 | echo '<tr>
|
128 |
| - <th>' . _('Type') . '</th> |
129 |
| - <th>' . _('Number') . '</th> |
130 |
| - <th>' . _('Date') . '</th> |
131 |
| - <th>' . _('User ID') . '</th> |
132 |
| - <th>' . _('Customer') . '</th> |
133 |
| - <th>' . _('Branch') . '</th> |
134 |
| - <th>' . _('Quantity') . '</th> |
135 |
| - <th>' . _('Reference') . '</th> |
136 |
| - <th>' . _('Price') . '</th> |
137 |
| - <th>' . _('Discount') . '</th> |
| 128 | + <th>' . _('Type') . '</th> |
| 129 | + <th>' . _('Number') . '</th> |
| 130 | + <th>' . _('Date') . '</th> |
| 131 | + <th>' . _('User ID') . '</th> |
| 132 | + <th>' . _('Customer') . '</th> |
| 133 | + <th>' . _('Branch') . '</th> |
| 134 | + <th>' . _('Quantity') . '</th> |
| 135 | + <th>' . _('Reference') . '</th> |
| 136 | + <th>' . _('Price') . '</th> |
| 137 | + <th>' . _('Discount') . '</th> |
138 | 138 | <th>' . _('New Qty') . '</th>';
|
139 | 139 | if ($myrow['controlled'] == 1) {
|
140 | 140 | echo '<th>', _('Serial No.'), '</th>';
|
|
145 | 145 |
|
146 | 146 | while ($myrow = DB_fetch_array($MovtsResult)) {
|
147 | 147 |
|
148 |
| - $DisplayTranDate = ConvertSQLDate($myrow['trandate']); |
| 148 | + $DisplayTranDate = ConvertSQLDate($myrow['trandate']); |
149 | 149 |
|
150 | 150 | $SerialSQL = "SELECT serialno, moveqty FROM stockserialmoves WHERE stockmoveno='" . $myrow['stkmoveno'] . "'";
|
151 | 151 | $SerialResult = DB_query($SerialSQL);
|
|
179 | 179 | }
|
180 | 180 | echo '</tr>';
|
181 | 181 |
|
182 |
| - } elseif ($myrow['type']==11){ |
| 182 | + } elseif ($myrow['type']==11){ |
183 | 183 |
|
184 | 184 | echo '<tr class="striped_row">
|
185 | 185 | <td><a target="_blank" href="', $RootPath, '/PrintCustTrans.php?FromTransNo=', urlencode($myrow['transno']), '&InvOrCredit=Credit">', $myrow['typename'], '</a></td>
|
|
198 | 198 | }
|
199 | 199 | echo '</tr>';
|
200 | 200 |
|
201 |
| - } else { |
| 201 | + } else { |
202 | 202 |
|
203 | 203 | echo '<tr class="striped_row">
|
204 | 204 | <td>', $myrow['typename'], '</td>
|
|
230 | 230 | <br /><a href="', $RootPath, '/SelectSalesOrder.php?SelectedStockItem=', urlencode($StockID), '&StockLocation=', urlencode($_POST['StockLocation']), '">', _('Search Outstanding Sales Orders'), '</a>
|
231 | 231 | <br /><a href="', $RootPath, '/SelectCompletedOrder.php?SelectedStockItem=', urlencode($StockID), '">', _('Search Completed Sales Orders'), '</a>
|
232 | 232 | </div>
|
233 |
| - </div> |
234 |
| - </form>'; |
| 233 | + </div> |
| 234 | + </form>'; |
235 | 235 |
|
236 | 236 | include('includes/footer.php');
|
237 | 237 |
|
|
0 commit comments