Example #1
0
    if (isset($_SESSION['Transfer']->StockLocationFrom)) {
        if ($myrow['loccode'] == $_SESSION['Transfer']->StockLocationFrom) {
            echo '<OPTION SELECTED Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
        } else {
            echo '<OPTION Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
        }
    } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) {
        echo '<OPTION SELECTED Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
        $_SESSION['Transfer']->StockLocationFrom = $myrow['loccode'];
    } else {
        echo '<OPTION Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
    }
}
echo '</SELECT></TD></TR>';
echo '<TR><TD>' . _('To Stock Location') . ': </TD><TD><SELECT name="StockLocationTo"> ';
DB_data_seek($resultStkLocs, 0);
while ($myrow = DB_fetch_array($resultStkLocs)) {
    if (isset($_SESSION['Transfer']->StockLocationTo)) {
        if ($myrow['loccode'] == $_SESSION['Transfer']->StockLocationTo) {
            echo '<OPTION SELECTED Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
        } else {
            echo '<OPTION Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
        }
    } elseif ($myrow['loccode'] == $_SESSION['UserStockLocation']) {
        echo '<OPTION SELECTED Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
        $_SESSION['Transfer']->StockLocationTo = $myrow['loccode'];
    } else {
        echo '<OPTION Value="' . $myrow['loccode'] . '">' . $myrow['locationname'];
    }
}
echo '</SELECT></TD></TR>';
Example #2
0
				<td>' . $myrow['description'] . '</td>
				<td>' . $myrow['serialno'] . '</td>
				<td class="number">' . locale_number_format($myrow['cost'], $_SESSION['CompanyRecord']['decimalplaces']) . '</td>
				<td class="number">' . locale_number_format($myrow['accumdepn'], $_SESSION['CompanyRecord']['decimalplaces']) . '</td>
				<td>' . $myrow['ItemAssetLocation'] . '</td>';
        echo '<td><select minlength="0" name="Location' . $myrow['assetid'] . '" onchange="ReloadForm(Move' . $myrow['assetid'] . ')">';
        $ThisDropDownName = 'Location' . $myrow['assetid'];
        while ($LocationRow = DB_fetch_array($LocationResult)) {
            if (isset($_POST[$ThisDropDownName]) and $_POST[$ThisDropDownName] == $LocationRow['locationid']) {
                echo '<option selected="selected" value="' . $LocationRow['locationid'] . '">' . $LocationRow['locationdescription'] . '</option>';
            } elseif ($LocationRow['locationid'] == $myrow['ItemAssetLocation']) {
                echo '<option selected="selected" value="' . $LocationRow['locationid'] . '">' . $LocationRow['locationdescription'] . '</option>';
            } else {
                echo '<option value="' . $LocationRow['locationid'] . '">' . $LocationRow['locationdescription'] . '</option>';
            }
        }
        DB_data_seek($LocationResult, 0);
        echo '</select></td>';
        echo '<input type="hidden" name="AssetCat" value="' . $_POST['AssetCat'] . '" />';
        echo '<input type="hidden" name="AssetLocation" value="' . $_POST['AssetLocation'] . '" />';
        echo '<input type="hidden" name="Keywords" value="' . $_POST['Keywords'] . '" />';
        echo '<input type="hidden" name="AssetID" value="' . $_POST['AssetID'] . '" />';
        echo '<input type="hidden" name="Search" value="' . $_POST['Search'] . '" />';
        echo '<td><input type="submit" name="Move' . $myrow['assetid'] . '" value="Move" /></td>';
        echo '</tr>';
    }
    echo '</table>
		  </div>
		  </form>';
}
include 'includes/footer.inc';
 $myrow = DB_fetch_row($Result);
 $CurrencyRate = $myrow[0];
 $SQL = "SELECT taxprovinceid FROM locations WHERE loccode='" . $RecurrOrderRow['fromstkloc'] . "'";
 $ErrMsg = _('Could not retreive the tax province of the location from where the order was fulfilled because:');
 $Result = DB_query($SQL, $db, $ErrMsg);
 $myrow = DB_fetch_row($Result);
 $DispTaxProvinceID = $myrow[0];
 /*Now Get the next invoice number - function in SQL_CommonFunctions*/
 $InvoiceNo = GetNextTransNo(10, $db);
 $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
 /*Start an SQL transaction */
 $SQL = "BEGIN";
 $Result = DB_query($SQL, $db);
 $TotalFXNetInvoice = 0;
 $TotalFXTax = 0;
 DB_data_seek($LineItemsResult, 0);
 $LineCounter = 0;
 while ($RecurrOrderLineRow = DB_fetch_array($LineItemsResult)) {
     $LineNetAmount = $RecurrOrderLineRow['unitprice'] * $RecurrOrderLineRow['quantity'] * (1 - floatval($RecurrOrderLineRow['discountpercent']));
     /*Gets the Taxes and rates applicable to this line from the TaxGroup of the branch and TaxCategory of the item
     		and the taxprovince of the dispatch location */
     $SQL = "SELECT taxgrouptaxes.calculationorder,\n\t\t\t\t\ttaxauthorities.description,\n\t\t\t\t\ttaxgrouptaxes.taxauthid,\n\t\t\t\t\ttaxauthorities.taxglcode,\n\t\t\t\t\ttaxgrouptaxes.taxontax,\n\t\t\t\t\ttaxauthrates.taxrate\n\t\t\tFROM taxauthrates INNER JOIN taxgrouptaxes ON\n\t\t\t\ttaxauthrates.taxauthority=taxgrouptaxes.taxauthid\n\t\t\t\tINNER JOIN taxauthorities ON\n\t\t\t\ttaxauthrates.taxauthority=taxauthorities.taxid\n\t\t\tWHERE taxgrouptaxes.taxgroupid=" . $RecurrOrderRow['taxgroupid'] . "\n\t\t\tAND taxauthrates.dispatchtaxprovince=" . $DispTaxProvinceID . "\n\t\t\tAND taxauthrates.taxcatid = " . $RecurrOrderLineRow['taxcatid'] . "\n\t\t\tORDER BY taxgrouptaxes.calculationorder";
     $ErrMsg = _('The taxes and rates for this item could not be retreived because');
     $GetTaxRatesResult = DB_query($SQL, $db, $ErrMsg);
     $LineTaxAmount = 0;
     $TaxTotals = array();
     while ($myrow = DB_fetch_array($GetTaxRatesResult)) {
         if (!isset($TaxTotals[$myrow['taxauthid']]['FXAmount'])) {
             $TaxTotals[$myrow['taxauthid']]['FXAmount'] = 0;
         }
         $TaxAuthID = $myrow['taxauthid'];
			<input type="hidden" name="CompareVal' . $x . '" value="' . $CompareVal . '" /> 
			</td>
			<td>' . $myrow['method'] . '</td>
			<td>' . $RangeDisplay . '</td>
			<td>' . $myrow['targetvalue'] . ' ' . $myrow['units'] . '</td>
			<td><input type="text" class="date" name="TestDate' . $x . '" size="10" maxlength="10" value="' . $TestDate . '" /> </td>
			<td><select name="TestedBy' . $x . '"/>';
    while ($techrow = DB_fetch_array($techresult)) {
        if ($techrow['userid'] == $myrow['testedby']) {
            echo '<option selected="selected" value="' . $techrow['userid'] . '">' . $techrow['realname'] . '</option>';
        } else {
            echo '<option value="' . $techrow['userid'] . '">' . $techrow['realname'] . '</option>';
        }
    }
    echo '</select>';
    DB_data_seek($techresult, 0);
    echo '<td>' . $TestResult . '</td>
			<td>' . $ShowOnCert . '</td>
			<td>' . $Delete . '</td>
		</tr>';
}
echo '</table><div class="centre">
		<input type="hidden" name="TestResultsCounter" value="' . $x . '" />
		<input type="submit" name="submit" value="' . _('Enter Information') . '" />
	</div>
	</div>
	</form>';
echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?ListTests=yes&amp;SelectedSampleID=' . $SelectedSampleID . '">' . _('Add More Tests') . '</a></div>';
echo '<div class="centre"><a href="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?CopyResults=yes&amp;SelectedSampleID=' . $SelectedSampleID . '">' . _('Copy These Results') . '</a></div>';
if ($CanCert == 1) {
    echo '<div class="centre"><a target="_blank" href="' . $RootPath . '/PDFCOA.php?LotKey=' . $LotKey . '&ProdSpec=' . $ProdSpec . '">' . _('Print COA') . '</a></div>';
Example #5
0
                $sql = "SELECT stockmaster.stockid,\n\t\t\t\t\t\t\t\tstockmaster.description,\n\t\t\t\t\t\t\t\tstockmaster.units\n\t\t\t\t\t\tFROM stockmaster INNER JOIN stockcategory\n\t\t\t\t\t\tON stockmaster.categoryid=stockcategory.categoryid\n\t\t\t\t\t\tINNER JOIN purchdata \n\t\t\t\t\t\tON stockmaster.stockid=purchdata.stockid\n\t\t\t\t\t\tWHERE stockmaster.mbflag<>'D'\n\t\t\t\t\t\tAND stockmaster.mbflag<>'K'\n\t\t\t\t\t\tAND stockmaster.mbflag<>'G'\n\t\t\t\t\t\tAND purchdata.supplierno='" . $_SESSION['PO' . $identifier]->SupplierID . "'\n\t\t\t\t\t\tAND stockmaster.discontinued<>1\n\t\t\t\t\t\tAND stockmaster.categoryid='" . $_POST['StockCat'] . "'\n\t\t\t\t\t\tORDER BY stockmaster.stockid\n\t\t\t\t\t\tLIMIT " . $_SESSION['DefaultDisplayRecordsMax'];
            } else {
                $sql = "SELECT stockmaster.stockid,\n\t\t\t\t\t\t\tstockmaster.description,\n\t\t\t\t\t\t\tstockmaster.units\n\t\t\t\t\tFROM stockmaster INNER JOIN stockcategory\n\t\t\t\t\tON stockmaster.categoryid=stockcategory.categoryid\n\t\t\t\t\tWHERE stockmaster.mbflag<>'D'\n\t\t\t\t\tAND stockmaster.mbflag<>'K'\n\t\t\t\t\tAND stockmaster.mbflag<>'G'\n\t\t\t\t\tAND stockmaster.discontinued<>1\n\t\t\t\t\tAND stockmaster.categoryid='" . $_POST['StockCat'] . "'\n\t\t\t\t\tORDER BY stockmaster.stockid\n\t\t\t\t\tLIMIT " . $_SESSION['DefaultDisplayRecordsMax'];
            }
        }
    }
    $ErrMsg = _('There is a problem selecting the part records to display because');
    $DbgMsg = _('The SQL statement that failed was');
    $SearchResult = DB_query($sql, $db, $ErrMsg, $DbgMsg);
    if (DB_num_rows($SearchResult) == 0 and $debug == 1) {
        prnMsg(_('There are no products to display matching the criteria provided'), 'warn');
    }
    if (DB_num_rows($SearchResult) == 1) {
        $myrow = DB_fetch_array($SearchResult);
        $_GET['NewItem'] = $myrow['stockid'];
        DB_data_seek($SearchResult, 0);
    }
}
//end of if search
if (!isset($_GET['Edit'])) {
    $sql = "SELECT categoryid,\n\t\t\t\tcategorydescription\n\t\t\tFROM stockcategory\n\t\t\tWHERE stocktype<>'L'\n\t\t\tAND stocktype<>'D'\n\t\t\tORDER BY categorydescription";
    $ErrMsg = _('The supplier category details could not be retrieved because');
    $DbgMsg = _('The SQL used to retrieve the category details but failed was');
    $result1 = DB_query($sql, $db, $ErrMsg, $DbgMsg);
    echo '<table class="selection">
			<tr>
				<th colspan="3"><h3>' . _('Search For Stock Items') . ':</h3></th>';
    echo '</tr>
			<tr><td>' . _('Item Category') . ': <select name="StockCat">';
    echo '<option selected="selected" value="All">' . _('All') . '</option>';
    while ($myrow1 = DB_fetch_array($result1)) {
				</div>';
        }
        echo '<table cellpadding="2">';
        echo '<tr>
				<th>' . _('Code') . '</th>
				<th>' . _('Description') . '</th>
				<th>' . _('Total Qty On Hand') . '</th>
				<th>' . _('Units') . '</th>
				<th>' . _('Stock Status') . '</th>
			</tr>';
        $j = 1;
        $k = 0;
        //row counter to determine background colour
        $RowIndex = 0;
        if (DB_num_rows($searchresult) != 0) {
            DB_data_seek($searchresult, ($_POST['PageOffset'] - 1) * $_SESSION['DisplayRecordsMax']);
        }
        while ($myrow = DB_fetch_array($searchresult) and $RowIndex != $_SESSION['DisplayRecordsMax']) {
            if ($k == 1) {
                echo '<tr class="EvenTableRows">';
                $k = 0;
            } else {
                echo '<tr class="OddTableRows">';
                $k++;
            }
            if ($myrow['mbflag'] == 'D') {
                $qoh = _('N/A');
            } else {
                $qoh = locale_number_format($myrow['qoh'], $myrow['decimalplaces']);
            }
            if ($myrow['discontinued'] == 1) {
    } else {
        echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['accountname'] . ' (' . $myrow['accountcode'] . ')</option>';
    }
}
//end while loop
echo '</select></td></tr>';
DB_data_seek($PnLAccountsResult, 0);
echo '<tr><td>' . _('Profit or Loss on Disposal GL Code:') . '</td><td><select name="DisposalAct">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
    if (isset($_POST['DisposalAct']) and $myrow['accountcode'] == $_POST['DisposalAct']) {
        echo '<option selected="True" value="' . $myrow['accountcode'] . '">' . $myrow['accountname'] . ' (' . $myrow['accountcode'] . ')' . '</option>';
    } else {
        echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['accountname'] . ' (' . $myrow['accountcode'] . ')' . '</option>';
    }
}
//end while loop
echo '</select></td></tr>';
DB_data_seek($BSAccountsResult, 0);
echo '<tr><td>' . _('Balance Sheet Accumulated Depreciation GL Code') . ':</td><td><select name="AccumDepnAct">';
while ($myrow = DB_fetch_array($BSAccountsResult)) {
    if (isset($_POST['AccumDepnAct']) and $myrow['accountcode'] == $_POST['AccumDepnAct']) {
        echo '<option selected="True" value="' . $myrow['accountcode'] . '">' . $myrow['accountname'] . ' (' . $myrow['accountcode'] . ')' . '</option>';
    } else {
        echo '<option value="' . $myrow['accountcode'] . '">' . $myrow['accountname'] . ' (' . $myrow['accountcode'] . ')' . '</option>';
    }
}
//end while loop
echo '</select></td></tr></table><br />';
echo '<div class="centre"><button type="submit" name="submit">' . _('Enter Information') . '</button></div>';
echo '</form><br />';
include 'includes/footer.inc';
Example #8
0
    //end while loop
    echo '</select></td></tr>';
    echo '<tr><td>' . _('Post Sales to GL Account') . ":</td><td><select name='SalesGLCode'>";
    DB_free_result($result);
    $SQL = "SELECT chartmaster.accountcode,\n\t\t\tchartmaster.accountname\n\t\tFROM chartmaster,\n\t\t\taccountgroups\n\t\tWHERE chartmaster.group_=accountgroups.groupname\n\t\tAND accountgroups.pandl=1\n\t\tORDER BY accountgroups.sequenceintb, \n\t\t\tchartmaster.accountcode";
    $result = DB_query($SQL, $db);
    while ($myrow = DB_fetch_array($result)) {
        if (isset($_POST['SalesGLCode']) and $myrow['accountcode'] == $_POST['SalesGLCode']) {
            echo "<option selected VALUE='";
        } else {
            echo "<option VALUE='";
        }
        echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname'];
    }
    //end while loop
    DB_data_seek($result, 0);
    echo '</td></tr>
		<tr><td>' . _('Post Discount to GL Account') . ":</td>\n\t\t\t<td><select name='DiscountGLCode'>";
    while ($myrow = DB_fetch_array($result)) {
        if (isset($_POST['DiscountGLCode']) and $myrow['accountcode'] == $_POST['DiscountGLCode']) {
            echo "<option selected VALUE='";
        } else {
            echo "<option VALUE='";
        }
        echo $myrow['accountcode'] . "'>" . $myrow['accountcode'] . ' - ' . $myrow['accountname'];
    }
    //end while loop
    echo '</select></td>
	</tr>
	</table>';
    echo "<div class='centre'><input type='Submit' name='submit' value='" . _('Enter Information') . "'></div>";
				<td><input type="text" class="number" size="11" value="1" name="LeadTime0" /></td>';
        echo '<td><input type="checkbox" name="Preferred0" /></td>';
        echo '<td><input type="text" class="date" size="11" value="' . date($_SESSION['DefaultDateFormat']) . '" alt="' . $_SESSION['DefaultDateFormat'] . '"  name="EffectiveFrom0" /></td>
				<td><input type="text" size="20" maxlength="50" value="" name="SupplierPartNo0" /></td>
				<td><input type="text" class="number" size="11" value="1" name="MinOrderQty0" /></td>
				<td><button type="submit" style="width:100%;text-align:left" title="' . _('Insert this record') . '" name="Insert"><img width="15px" src="' . $rootpath . '/css/' . $theme . '/images/tick.png" /></button></td>
			</tr>';
    }
    $RowCounter = 1;
    while ($myrow = DB_fetch_array($result)) {
        echo '<tr>
				<td><input type="hidden" value="' . $myrow['stockid'] . '" name="StockID' . $RowCounter . '" />' . $myrow['stockid'] . '</td>
				<td>' . $myrow['description'] . '</td>
				<td><input type="text" class="number" size="11" value="' . $myrow['price'] . '" name="Price' . $RowCounter . '" /></td>
				<td><select name="SuppUOM' . $RowCounter . '">';
        DB_data_seek($UOMResult, 0);
        while ($UOMRow = DB_fetch_array($UOMResult)) {
            if ($UOMRow['unitid'] == $myrow['suppliersuom']) {
                echo '<option selected="selected" value="' . $UOMRow['unitid'] . '">' . $UOMRow['unitname'] . '</option>';
            } else {
                echo '<option value="' . $UOMRow['unitid'] . '">' . $UOMRow['unitname'] . '</option>';
            }
        }
        echo '</select></td>
				<td><input type="text" class="number" size="11" value="' . $myrow['conversionfactor'] . '" name="ConversionFactor' . $RowCounter . '" /></td>
				<td><input type="text" class="number" size="11" value="' . $myrow['uomdecimalplaces'] . '" name="DecimalPlaces' . $RowCounter . '" /></td>
				<td><input type="text" size="30" maxlength="50" value="' . $myrow['supplierdescription'] . '" name="SupplierDescription' . $RowCounter . '" /></td>
				<td><input type="text" class="number" size="11" value="' . $myrow['leadtime'] . '" name="LeadTime' . $RowCounter . '" /></td>';
        if ($myrow['preferred'] == 1) {
            echo '<td><input type="checkbox" checked="checked" name="Preferred' . $RowCounter . '" /></td>';
        } else {
 }
 //**************Check to see if freight was added could do this in Substitution, skip if 0 freight
 //Get the message lines, replace variable names with data, write the output to a file one line at a time
 $sql = "SELECT section, linetext FROM edimessageformat WHERE partnercode='" . $CustDetails['debtorno'] . "' AND messagetype='INVOIC' ORDER BY sequenceno";
 $ErrMsg = _('An error occurred in getting the EDI format template for') . ' ' . $CustDetails['debtorno'] . ' ' . _('because');
 $MessageLinesResult = DB_query($sql, $ErrMsg);
 if (DB_num_rows($MessageLinesResult) > 0) {
     $DetailLines = array();
     $ArrayCounter = 0;
     while ($MessageLine = DB_fetch_array($MessageLinesResult)) {
         if ($MessageLine['section'] == 'Detail') {
             $DetailLines[$ArrayCounter] = $MessageLine['linetext'];
             $ArrayCounter++;
         }
     }
     DB_data_seek($MessageLinesResult, 0);
     $EDITransNo = GetNextTransNo(99, $db);
     $fp = fopen('EDI_INV_' . $TransNo . '.txt', 'w');
     while ($LineDetails = DB_fetch_array($MessageLinesResult)) {
         if ($LineDetails['section'] == 'Heading') {
             $MsgLineText = $LineDetails['linetext'];
             include 'includes/EDIVariableSubstitution.inc';
             $LastLine = 'Heading';
         }
         if ($LineDetails['section'] == 'Detail' and $LastLine == 'Heading') {
             /*This must be the detail section
             		need to get the line details for the invoice or credit note
             		for creating the detail lines */
             if ($TransDetails['type'] == 10) {
                 /*its an invoice */
                 $sql = "SELECT stockmoves.stockid,\n\t\t\t\t\t\t \t\tstockmaster.description,\n\t\t\t\t\t\t\t\t-stockmoves.qty as quantity,\n\t\t\t\t\t\t\t\tstockmoves.discountpercent,\n\t\t\t\t\t\t\t\t((1 - stockmoves.discountpercent) * stockmoves.price * " . $ExchRate . " * -stockmoves.qty) AS fxnet,\n\t\t\t\t\t\t\t\t(stockmoves.price * " . $ExchRate . ") AS fxprice,\n\t\t\t\t\t\t\t\tstockmaster.units\n\t\t\t\t\t\t\tFROM stockmoves,\n\t\t\t\t\t\t\t\tstockmaster\n\t\t\t\t\t\t\tWHERE stockmoves.stockid = stockmaster.stockid\n\t\t\t\t\t\t\tAND stockmoves.type=10\n\t\t\t\t\t\t\tAND stockmoves.transno=" . $TransNo . "\n\t\t\t\t\t\t\tAND stockmoves.show_on_inv_crds=1";
Example #11
0
			<td>' . $WORow['locationname'] . '</td>
			<td class="label">' . _('Required By') . ':</td>
			<td>' . ConvertSQLDate($WORow['requiredby']) . '</td>
		</tr>
		<tr>
			<td class="label">' . 'Item' . '</td>
			<td class="label">' . _('Quantity Ordered') . ':</td>
			<td class="label">' . _('Already Received') . ':</td>
			<td class="label">' . _('Unit') . ':</td>
		</tr>';
if ($WORow['closed'] == 1) {
    prnMsg(_('The selected work order has been closed and variances calculated and posted. No more issues of materials and components can be made against this work order.'), 'info');
    include 'includes/footer.inc';
    exit;
}
DB_data_seek($WOResult, 0);
while ($WORow = DB_fetch_array($WOResult)) {
    echo '<tr>
				<td>' . $WORow['stockid'] . ' - ' . $WORow['description'] . '</td>
				<td class="number">' . locale_number_format($WORow['qtyreqd'], $WORow['decimalplaces']) . '</td>
				<td class="number">' . locale_number_format($WORow['qtyrecd'], $WORow['decimalplaces']) . '</td>
				<td>' . $WORow['units'] . '</td>
			</tr>';
}
echo '<tr>
		<td class="label">' . _('Date Material Issued') . ':</td>
		<td><input type="text" name="IssuedDate" value="' . Date($_SESSION['DefaultDateFormat']) . '" class="date" size="10" alt="' . $_SESSION['DefaultDateFormat'] . '" /></td>
		<td class="label">' . _('Issued From') . ':</td>
		<td>';
if (!isset($_POST['IssueItem'])) {
    $LocResult = DB_query("SELECT loccode, locationname FROM locations", $db);
        $DataError = 1;
        echo '<a href="SalesTypes.php?" target="_parent">Setup Types</a>';
        echo '<tr><td colspan=2>' . prnMsg(_('No sales types/price lists defined'), 'error') . '</td></tr>';
    } else {
        echo '<tr><td>' . _('Price List') . ':</td>
				<td><select tabindex="9" name="SalesType">';
        echo '<option value=""></option>';
        while ($TypeRow = DB_fetch_array($TypeResult)) {
            if ($TypeRow['typeabbrev'] == $myrow['salestype']) {
                echo '<option selected="selected" value="' . $TypeRow['typeabbrev'] . '">' . $TypeRow['sales_type'] . '</option>';
            } else {
                echo '<option value="' . $TypeRow['typeabbrev'] . '">' . $TypeRow['sales_type'] . '</option>';
            }
        }
        //end while loopre
        DB_data_seek($TypeResultesult, 0);
        echo '</select></td></tr>';
    }
    $sql = "SELECT reasoncode,\n\t\t\t\treasondescription\n\t\t\t\tFROM holdreasons";
    $SexResult = DB_query($sql, $db);
    echo '<tr><td>' . _('Sex') . ':</td>';
    echo '<td><select name="Sex">';
    echo '<option value=""></option>';
    while ($SexRow = DB_fetch_array($SexResult)) {
        if ($SexRow['reasoncode'] == $myrow['holdreason']) {
            echo '<option selected="selected" value="' . $SexRow['reasoncode'] . '">' . $SexRow['reasondescription'] . '</option>';
        } else {
            echo '<option value="' . $SexRow['reasoncode'] . '">' . $SexRow['reasondescription'] . '</option>';
        }
    }
    echo '</select></td></tr>';
Example #13
0
function ShowCustomerSearchFields($rootpath, $theme, $db)
{
    echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '" method="post">';
    echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
    echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/magnifier.png" title="' . _('Search') . '" alt="" />' . ' ' . _('Search for Customers') . '</p>';
    echo '<table cellpadding="3" class="selection">';
    echo '<tr><td colspan="2">' . _('Enter a partial Name') . ':</td><td>';
    if (isset($_POST['Keywords'])) {
        echo '<input type="text" name="Keywords" value="' . $_POST['Keywords'] . '" size="20" maxlength="25" />';
    } else {
        echo '<input type="text" name="Keywords" size="20" maxlength="25" />';
    }
    echo '</td><td><font size="3"><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Code') . ':</td><td>';
    if (isset($_POST['CustCode'])) {
        echo '<input type="text" name="CustCode" value="' . $_POST['CustCode'] . '" size="15" maxlength="18" />';
    } else {
        echo '<input type="text" name="CustCode" size="15" maxlength="18" />';
    }
    echo '</td></tr><tr><td><font size="3"><b>' . _('OR') . '</b></font></td><td>' . _('Enter a partial Phone Number') . ':</td><td>';
    if (isset($_POST['CustPhone'])) {
        echo '<input type="text" name="CustPhone" value="' . $_POST['CustPhone'] . '" size="15" maxlength="18" />';
    } else {
        echo '<input type="text" name="CustPhone" size="15" maxlength="18" />';
    }
    echo '</td>';
    echo '<td><font size="3"><b>' . _('OR') . '</b></font></td><td>' . _('Enter part of the Address') . ':</td><td>';
    if (isset($_POST['CustAdd'])) {
        echo '<input type="text" name="CustAdd" value="' . $_POST['CustAdd'] . '" size="20" maxlength="25" />';
    } else {
        echo '<input type="text" name="CustAdd" size="20" maxlength="25" />';
    }
    echo '</td></tr>';
    /* End addded search feature. Gilles Deacur */
    echo '<tr><td><font size="3"><b>' . _('OR') . '</b></font></td><td>' . _('Choose a Type') . ':</td><td>';
    if (isset($_POST['CustType'])) {
        // Show Customer Type drop down list
        $result2 = DB_query("SELECT typeid, typename FROM debtortype", $db);
        // Error if no customer types setup
        if (DB_num_rows($result2) == 0) {
            $DataError = 1;
            echo '<a href="CustomerTypes.php?" target="_parent">Setup Types</a>';
            echo '<tr><td colspan="2">' . prnMsg(_('No Customer types defined'), 'error') . '</td></tr>';
        } else {
            // If OK show select box with option selected
            echo '<select name="CustType">';
            echo '<option value="ALL">' . _('Any') . '</option>';
            while ($myrow = DB_fetch_array($result2)) {
                if ($_POST['CustType'] == $myrow['typename']) {
                    echo '<option selected="True" value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>';
                } else {
                    echo '<option value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>';
                }
            }
            //end while loop
            DB_data_seek($result2, 0);
            echo '</select></td>';
        }
    } else {
        // No option selected yet, so show Customer Type drop down list
        $result2 = DB_query("SELECT typeid, typename FROM debtortype", $db);
        // Error if no customer types setup
        if (DB_num_rows($result2) == 0) {
            $DataError = 1;
            echo '<a href="CustomerTypes.php?" target="_parent">Setup Types</a>';
            echo '<tr><td colspan="2">' . prnMsg(_('No Customer types defined'), 'error') . '</td></tr>';
        } else {
            // if OK show select box with available options to choose
            echo '<select name="CustType">';
            echo '<option value="ALL">' . _('Any') . '</option>';
            while ($myrow = DB_fetch_array($result2)) {
                echo '<option value="' . $myrow['typename'] . '">' . $myrow['typename'] . '</option>';
            }
            //end while loop
            DB_data_seek($result2, 0);
            echo '</select></td>';
        }
    }
    /* Option to select a sales area */
    echo '<td><font size="3"><b>' . _('OR') . '</b></font></td><td>' . _('Choose an Area') . ':</td><td>';
    $result2 = DB_query("SELECT areacode, areadescription FROM areas", $db);
    // Error if no sales areas setup
    if (DB_num_rows($result2) == 0) {
        $DataError = 1;
        echo '<a href="Areas.php?" target="_parent">Setup Types</a>';
        echo '<tr><td colspan="2">' . prnMsg(_('No Sales Areas defined'), 'error') . '</td></tr>';
    } else {
        // if OK show select box with available options to choose
        echo '<select name="Area">';
        echo '<option value="ALL">' . _('Any') . '</option>';
        while ($myrow = DB_fetch_array($result2)) {
            if (isset($_POST['Area']) and $_POST['Area'] == $myrow['areacode']) {
                echo '<option selected="True" value="' . $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>';
            } else {
                echo '<option value="' . $myrow['areacode'] . '">' . $myrow['areadescription'] . '</option>';
            }
        }
        //end while loop
        DB_data_seek($result2, 0);
        echo '</select></td></tr>';
    }
    echo '</td></tr></table><br />';
    echo '<div class="centre"><button type="submit" name="Search">' . _('Search Now') . '</button></div><br />';
    if (isset($_SESSION['SalesmanLogin']) and $_SESSION['SalesmanLogin'] != '') {
        prnMsg(_('Your account enables you to see only customers allocated to you'), 'warn', _('Note: Sales-person Login'));
    }
}
Example #14
0
			<td>' . _('Cash Assigner') . ':</td><td><select name="SelectAssigner">';
    DB_data_seek($UsersResult);
    echo '<option value=""></option>';
    while ($myrow = DB_fetch_array($UsersResult)) {
        if (isset($_POST['SelectAssigner']) and $myrow['userid'] == $_POST['SelectAssigner']) {
            echo '<option selected="True" value="' . $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>';
        } else {
            echo '<option value="' . $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>';
        }
    }
    //end while loop get authorizer
    echo '</select></td></tr>';
    echo '<tr>
			<td>' . _('Authorizer') . ':</td>
			<td><select name="SelectAuthorizer">';
    DB_data_seek($UsersResult);
    echo '<option value=""></option>';
    while ($myrow = DB_fetch_array($UsersResult)) {
        if (isset($_POST['SelectAuthorizer']) and $myrow['userid'] == $_POST['SelectAuthorizer']) {
            echo '<option selected="True" value="' . $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>';
        } else {
            echo '<option value="' . $myrow['userid'] . '">' . $myrow['userid'] . ' - ' . $myrow['realname'] . '</option>';
        }
    }
    //end while loop get authorizer
    echo '</select></td></tr>';
    echo '<tr>
			<td>' . _('GL Account Cash Assignment') . ':</td>
			<td><select name="glaccountcash">';
    DB_free_result($result);
    $SQL = "SELECT chartmaster.accountcode, chartmaster.accountname\r\n\t\tFROM chartmaster, bankaccounts\r\n\t\tWHERE chartmaster.accountcode = bankaccounts.accountcode\r\n\t\tORDER BY chartmaster.accountcode";
    echo '</tr>';
}
DB_data_seek($Result, 0);
echo '<tr><td>' . _('Check every Invoice has a Tax Entry') . '</td></tr>';
while ($myrow = DB_fetch_array($Result)) {
    $SQL3 = "SELECT debtortransid\n\t\t\t\tFROM debtortranstaxes\n\t\t\t\tWHERE debtortransid = '" . $myrow['id'] . "'";
    $Result3 = DB_query($SQL3, $db);
    if (DB_num_rows($Result3) == 0) {
        echo '<td>' . _('Invoice ') . ' ' . $myrow['transno'] . ' : </td>';
        echo '<td><font color=red>' . _('has no Tax Entry') . '</font></td>';
    } else {
        echo '<td></td><td><font class="good">' . _('Tax Entry Exists') . '</font></td>';
    }
    echo '</tr>';
}
DB_data_seek($Result, 0);
echo '<br /><br />' . _('Check every Invoice has a GL Entry') . '<br />';
while ($myrow = DB_fetch_array($Result)) {
    $SQL4 = "SELECT typeno\n\t\t\t\tFROM gltrans\n\t\t\t\tWHERE type = 10\n\t\t\t\tAND typeno = '" . $myrow['transno'] . "'";
    $Result4 = DB_query($SQL4, $db);
    if (DB_num_rows($Result4) == 0) {
        echo '<br />' . _('Invoice') . ' ' . $myrow['transno'] . ' : ';
        echo '<font color=red>' . _('has no GL Entry') . '</font>';
    }
}
echo '<br /><br />' . _('Check for orphan GL Entries') . '<br />';
$SQL = "SELECT DISTINCT typeno,\n\t\t\t\t\tcounterindex\n\t\t\t\tFROM gltrans\n\t\t\t\tWHERE type = 10";
$Result = DB_query($SQL, $db);
while ($myrow = DB_fetch_array($Result)) {
    $SQL2 = "SELECT id,\n\t\t\t\t\ttransno,\n\t\t\t\t\ttrandate\n\t\t\t\tFROM debtortrans\n\t\t\t\tWHERE type = 10\n\t\t\t\tAND transno = '" . $myrow['typeno'] . "'";
    $Result2 = DB_query($SQL2, $db);
Example #16
0
     $SQL = "SELECT stockserialmoves.serialno,\n\t\t\t\tstockserialmoves.moveqty\n\t\t        FROM stockmoves INNER JOIN stockserialmoves\n\t\t\t\tON stockmoves.stkmoveno= stockserialmoves.stockmoveno\n\t\t\tWHERE stockmoves.stockid='" . $GRN['itemcode'] . "'\n\t\t\tAND stockmoves.type =25\n\t\t\tAND stockmoves.transno='" . $GRN['grnbatch'] . "'";
     $GetStockMoveResult = DB_query($SQL, $db, _('Could not retrieve the stock movement reference number which is required in order to retrieve details of the serial items that came in with this GRN'));
     while ($SerialStockMoves = DB_fetch_array($GetStockMoveResult)) {
         $SQL = "SELECT stockserialitems.quantity\n\t\t\t        FROM stockserialitems\n\t\t\t\tWHERE stockserialitems.stockid='" . $GRN['itemcode'] . "'\n\t\t\t\tAND stockserialitems.loccode ='" . $GRN['intostocklocation'] . "'\n\t\t\t\tAND stockserialitems.serialno ='" . $SerialStockMoves['serialno'] . "'";
         $GetQOHResult = DB_query($SQL, $db, _('Unable to retrieve the quantity on hand of') . ' ' . $GRN['itemcode'] . ' ' . _('for Serial No') . ' ' . $SerialStockMoves['serialno']);
         $GetQOH = DB_fetch_row($GetQOHResult);
         if ($GetQOH[0] < $SerialStockMoves['moveqty']) {
             /*Then some of the original goods received must have been sold
             		or transfered so cannot reverse the GRN */
             prnMsg(_('Unfortunately, of the original number') . ' (' . $SerialStockMoves['moveqty'] . ') ' . _('that were received on serial number') . ' ' . $SerialStockMoves['serialno'] . ' ' . _('only') . ' ' . $GetQOH[0] . ' ' . _('remain') . '. ' . _('The GRN can only be reversed if all the original serial number items are still in stock in the location they were received into'), 'error');
             include 'includes/footer.inc';
             exit;
         }
     }
     /*reset the pointer on this resultset ... will need it later */
     DB_data_seek($GetStockMoveResult, 0);
 } else {
     $Controlled = false;
 }
 /*Start an SQL transaction */
 $Result = DB_Txn_Begin($db);
 $PeriodNo = GetPeriod(ConvertSQLDate($GRN['deliverydate']), $db);
 /*Now the SQL to do the update to the PurchOrderDetails */
 $SQL = "UPDATE purchorderdetails\n\t\t\t\t\t\tSET quantityrecd = quantityrecd - '" . $QtyToReverse . "',\n\t\t\t\t\t\tcompleted=0\n\t\t\t\t\t\tWHERE purchorderdetails.podetailitem = '" . $GRN['podetailitem'] . "'";
 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase order detail record could not be updated with the quantity reversed because');
 $DbgMsg = _('The following SQL to update the purchase order detail record was used');
 $Result = DB_query($SQL, $db, $ErrMsg, $DbgMsg, true);
 /*Now the purchorder header status in case it was completed  - now incomplete - just printed */
 $SQL = "UPDATE purchorders\n\t\t\t\t\tSET status = 'Printed',\n\t\t\t\t\t\t\tstat_comment = CONCAT('" . Date($_SESSION['DefaultDateFormat']) . ' ' . _('GRN Reversed for') . ' ' . $GRN['itemdescription'] . ' ' . _('by') . ' ' . $_SESSION['UsersRealName'] . "<br />', stat_comment )\n\t\t\t\t\tWHERE  orderno = '" . $GRN['orderno'] . "'";
 $ErrMsg = _('CRITICAL ERROR') . '! ' . _('NOTE DOWN THIS ERROR AND SEEK ASSISTANCE') . ': ' . _('The purchase order statusand status comment could not be changed because');
 $DbgMsg = _('The following SQL to update the purchase order header record was used');
Example #17
0
    echo '<option selected="selected" value="SwipeHQ">' . _('Swipe HQ - New Zealand') . '</option>';
} else {
    echo '<option value="SwipeHQ">' . _('Swipe HQ - New Zealand') . '</option>';
}
echo '</select></td>
		<td>' . _('Select the credit card gateway system to be used.') . '</td>
	</tr>';
echo '<tr>
		<td>' . _('Credit Card Surcharge') . ':</td>
		<td><input type="text" class="number" size="5" maxlength="5" name="X_ShopCreditCardSurcharge" value="' . $_SESSION['ShopCreditCardSurcharge'] . '" /></td>
		<td>' . _('The credit card surcharge') . '</td>
	</tr>';
echo '<tr>
		<td>' . _('Credit Card Bank Account') . ':</td>
		<td><select minlength="0" name="X_ShopCreditCardBankAccount">';
DB_data_seek($BankAccountsResult, 0);
while ($BankAccountRow = DB_fetch_array($BankAccountsResult)) {
    if ($_SESSION['ShopCreditCardBankAccount'] == $BankAccountRow['accountcode']) {
        echo '<option selected="selected" value="' . $BankAccountRow['accountcode'] . '">' . $BankAccountRow['bankaccountname'] . '</option>';
    } else {
        echo '<option value="' . $BankAccountRow['accountcode'] . '">' . $BankAccountRow['bankaccountname'] . '</option>';
    }
}
echo '</select></td>
		<td>' . _('Select the KwaMoja bank account to use for receipts processed by credit card') . '</td>
	</tr>';
if ($AllowDemoMode) {
    echo '<tr>
			<td>' . _('Credit card user account details') . '</td>
			<td colspan="2">' . _('Cannot be set in the demo') . '</td>
		</tr>';
 include 'includes/header.inc';
 if (empty($_POST['FromCriteria']) or empty($_POST['ToCriteria'])) {
     /*if $FromCriteria is not set then show a form to allow input	*/
     echo '<p class="page_title_text"><img src="' . $rootpath . '/css/' . $theme . '/images/inventory.png" title="' . _('Inventory') . '" alt="" />' . ' ' . $title . '</p>';
     echo '<form action=' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . ' method="post">';
     echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
     echo '<table class="selection"><tr><td>' . _('From Inventory Category Code') . ':</font></td><td><select name=FromCriteria>';
     $sql = "SELECT categoryid, categorydescription FROM stockcategory ORDER BY categorydescription";
     $CatResult = DB_query($sql, $db);
     while ($myrow = DB_fetch_array($CatResult)) {
         echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>';
     }
     echo '</select></td></tr>';
     echo '<tr><td>' . _('To Inventory Category Code') . ':</td><td><select name=ToCriteria>';
     /*Set the index for the categories result set back to 0 */
     DB_data_seek($CatResult, 0);
     while ($myrow = DB_fetch_array($CatResult)) {
         echo '<option value="' . $myrow['categoryid'] . '">' . $myrow['categoryid'] . ' - ' . $myrow['categorydescription'] . '</option>';
     }
     echo '</select></td></tr>';
     echo '<tr><td>' . _('For Inventory in Location') . ':</td><td><select name="Location">';
     $sql = "SELECT loccode, locationname FROM locations";
     $LocnResult = DB_query($sql, $db);
     echo '<option value="All">' . _('All Locations') . '</option>';
     while ($myrow = DB_fetch_array($LocnResult)) {
         echo '<option value="' . $myrow['loccode'] . '">' . $myrow['locationname'] . '</option>';
     }
     echo '</select></td></tr>';
     echo '<tr><td>' . _('Summary or Detailed Report') . ':</td><td><select name="DetailedReport">';
     echo '<option selected="True" value="No">' . _('Summary Report') . '</option>';
     echo '<option value="Yes">' . _('Detailed Report') . '</option>';
Example #19
0
        $Type = 11;
    } else {
        $Type = 12;
    }
}
$sql = "SELECT \tdebtortrans.debtorno,\n\t\t\t\tdebtortrans.ovamount,\n\t\t\t\tdebtortrans.invtext,\n\t\t\t\tdebtortrans.alloc,\n\t\t\t\tsalesorderdetails.stkcode,\n\t\t\t\tstockmaster.description,\n\t\t\t\tsalesorderdetails.qtyinvoiced as quantity,\n\t\t\t\tsalesorderdetails.units,\n\t\t\t\tsalesorderdetails.unitprice\n\t\t\tFROM debtortrans\n\t\t\tLEFT JOIN salesorders\n\t\t\t\tON salesorders.orderno=debtortrans.order_\n\t\t\tLEFT JOIN salesorderdetails\n\t\t\t\tON salesorderdetails.orderno=debtortrans.order_\n\t\t\tLEFT JOIN stockmaster\n\t\t\t\tON stockmaster.stockid=salesorderdetails.stkcode\n\t\t\tWHERE type='" . $Type . "'\n\t\t\tAND transno='" . $_GET['FromTransNo'] . "'";
$MyOrderResult = DB_query($sql, $db);
$myrow = DB_fetch_array($MyOrderResult);
$DebtorNo = $myrow['debtorno'];
if (!isset($_GET['Amount'])) {
    $Amount = $myrow['alloc'];
} else {
    $Amount = -$_GET['Amount'];
}
$Narrative = $myrow['invtext'];
DB_data_seek($MyOrderResult, 0);
if ($Type != 12) {
    $LeftOvers = $pdf->addTextWrap(0, $YPos - $line_height * 11, 140, $FontSize, $Narrative);
}
$YPos -= 170;
$YPos -= $line_height;
//Note, this is ok for multilang as this is the value of a Select, text in option is different
$YPos -= 2 * $line_height;
/*Draw a rectangle to put the headings in     */
//$pdf->line(20, $YPos+$line_height,$Page_Width-$Right_Margin, $YPos+$line_height);
$FontSize = 14;
$YPos -= 1.5 * $line_height;
//$PageNumber++;
$sql = "SELECT currency,\n\t\t\t\tcurrabrev,\n\t\t\t\tdecimalplaces\n\t\t\t\t\tFROM currencies\n\t\t\t\t\tWHERE currabrev=(SELECT currcode\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM banktrans\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE type=10\n\t\t\t\t\t\t\t\t\t\t\t\t\tAND transno='" . $_GET['FromTransNo'] . "')";
$result = DB_query($sql, $db);
$myrow = DB_fetch_array($result);
Example #20
0
        $TotalUsageVar += $WOIssuesRow['qty'] * $WOIssuesRow['standardcost'];
    }
}
# <!--	<td colspan="5"></td> -->
echo '<tr><td colspan="3"></td><td><hr/></td><td colspan="2"></td><td colspan="3"><hr></td></tr>';
echo '<tr><td colspan="2" align="right">' . _('Totals') . '</td>
	<td></td>
	<td>' . number_format($TotalReqdCost, 2) . '</td>
	<td></td><td></td>
	<td>' . number_format($TotalIssuedCost, 2) . '</td>
	<td align="right">' . number_format($TotalUsageVar, 2) . '</td>
	<td align="right">' . number_format($TotalCostVar, 2) . '</td></tr>';
echo '<tr><td colspan="3"></td><td><hr/></td><td colspan="2"></td><td colspan="3"><hr></td></tr>';
#echo '<tr><td colspan="7"></td><td colspan="2"><hr></td></tr>';
if (isset($_POST['Close'])) {
    DB_data_seek($WOItemsResult, 0);
    $NoItemsOnWO = DB_num_rows($WOItemsResult);
    $TotalVariance = $TotalUsageVar + $TotalCostVar;
    $PeriodNo = GetPeriod(Date($_SESSION['DefaultDateFormat']), $db);
    $WOCloseNo = GetNextTransNo(29, $db);
    $TransResult = DB_Txn_Begin($db);
    while ($WORow = DB_fetch_array($WOItemsResult)) {
        if ($TotalStdValueRecd == 0) {
            $ShareProportion = 1 / $NoItemsOnWO;
        } else {
            $ShareProportion = $WORow['stdcost'] * $WORow['qtyrecd'] / $TotalStdValueRecd;
        }
        if ($_SESSION['WeightedAverageCosting'] == 1) {
            //we need to post the variances to stock and update the weighted average cost
            /*  need to get the current total quantity on hand
            			if the quantity on hand is less than the quantity received on the work order
    foreach ($_POST as $ScriptName => $PageSecurityValue) {
        if ($ScriptName != 'Update' and $ScriptName != 'FormID') {
            $ScriptName = substr($ScriptName, 0, strlen($ScriptName) - 4) . '.php';
            $sql = "UPDATE pagesecurity SET security='" . $PageSecurityValue . "' WHERE script='" . $ScriptName . "'";
            $UpdateResult = DB_query($sql, $db, _('Could not update the page security value for the script because'));
        }
    }
}
$sql = "SELECT script,\n\t\t\tsecurity\n\t\t\tFROM pagesecurity";
$result = DB_query($sql, $db);
echo '<br /><form method="post" id="PageSecurity" action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<table class="selection">';
$TokenSql = "SELECT tokenid,\n\t\t\t\t\ttokenname\n\t\t\t\tFROM securitytokens\n\t\t\t\tORDER BY tokenname";
$TokenResult = DB_query($TokenSql, $db);
while ($myrow = DB_fetch_array($result)) {
    echo '<tr><td>' . $myrow['script'] . '</td>';
    echo '<td><select name="' . $myrow['script'] . '">';
    while ($mytokenrow = DB_fetch_array($TokenResult)) {
        if ($mytokenrow['tokenid'] == $myrow['security']) {
            echo '<option selected="True" value="' . $mytokenrow['tokenid'] . '">' . $mytokenrow['tokenname'] . '</option>';
        } else {
            echo '<option value="' . $mytokenrow['tokenid'] . '">' . $mytokenrow['tokenname'] . '</option>';
        }
    }
    echo '</select></td></tr>';
    DB_data_seek($TokenResult, 0);
}
echo '</table><br />';
echo '<div class="centre"><button type="submit" name="Update">' . _('Update Security Levels') . '</button></div><br /></form>';
include 'includes/footer.inc';
}
//end while loop
DB_data_seek($PnLAccountsResult, 0);
echo '</select></td></tr>';
echo '<tr>
		<td>' . _('Price Variance GL Code') . ':</td>
		<td><select name="PurchPriceVarAct">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
    if (isset($_POST['PurchPriceVarAct']) and $myrow['accountcode'] == $_POST['PurchPriceVarAct']) {
        echo '<option selected="selected" value="' . $myrow['accountcode'] . '">' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . ' (' . $myrow['accountcode'] . ')' . '</option>';
    } else {
        echo '<option value="' . $myrow['accountcode'] . '">' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . ' (' . $myrow['accountcode'] . ')' . '</option>';
    }
}
//end while loop
DB_data_seek($PnLAccountsResult, 0);
echo '</select></td>
		</tr>
		<tr>
			<td>';
if (isset($_POST['StockType']) and $_POST['StockType'] == 'L') {
    echo _('Labour Efficiency Variance GL Code');
} else {
    echo _('Usage Variance GL Code');
}
echo ':</td>
		<td><select name="MaterialUseageVarAc">';
while ($myrow = DB_fetch_array($PnLAccountsResult)) {
    if (isset($_POST['MaterialUseageVarAc']) and $myrow['accountcode'] == $_POST['MaterialUseageVarAc']) {
        echo '<option selected="selected" value="' . $myrow['accountcode'] . '">' . htmlspecialchars($myrow['accountname'], ENT_QUOTES, 'UTF-8', false) . ' (' . $myrow['accountcode'] . ')' . '</option>';
    } else {
Example #23
0
    $DispTaxProvincesResult = DB_query("SELECT taxprovinceid FROM locations", $db);
    $TaxCatsResult = DB_query("SELECT taxcatid FROM taxcategories", $db);
    if (DB_num_rows($TaxCatsResult) > 0) {
        // This will only work if there are levels else we get an error on seek.
        while ($myrow = DB_fetch_row($DispTaxProvincesResult)) {
            /*Check to see there are TaxAuthRates records set up for this TaxProvince */
            $NoTaxRates = DB_query("SELECT taxauthority FROM taxauthrates WHERE dispatchtaxprovince='" . $myrow[0] . "'", $db);
            if (DB_num_rows($NoTaxRates) < $NoTaxAuths[0]) {
                /*First off delete any tax authoritylevels already existing */
                $DelTaxAuths = DB_query("DELETE FROM taxauthrates WHERE dispatchtaxprovince='" . $myrow[0] . "'", $db);
                /*Now add the new TaxAuthRates required */
                while ($CatRow = DB_fetch_row($TaxCatsResult)) {
                    $sql = "INSERT INTO taxauthrates (taxauthority,\n\t\t\t\t\t\t\t\t\t\tdispatchtaxprovince,\n\t\t\t\t\t\t\t\t\t\ttaxcatid)\n\t\t\t\t\t\t\tSELECT taxid,\n\t\t\t\t\t\t\t\t'" . $myrow[0] . "',\n\t\t\t\t\t\t\t\t'" . $CatRow[0] . "'\n\t\t\t\t\t\t\tFROM taxauthorities";
                    $InsTaxAuthRates = DB_query($sql, $db);
                }
                DB_data_seek($TaxCatsResult, 0);
            }
        }
    }
} elseif (isset($_GET['delete'])) {
    //the link to delete a selected record was clicked instead of the submit button
    $CancelDelete = 0;
    // PREVENT DELETES IF DEPENDENT RECORDS
    $sql = "SELECT COUNT(*) FROM salesorders WHERE fromstkloc='" . $SelectedLocation . "'";
    $result = DB_query($sql, $db);
    $myrow = DB_fetch_row($result);
    if ($myrow[0] > 0) {
        $CancelDelete = 1;
        prnMsg(_('Cannot delete this location because sales orders have been created delivering from this location'), 'warn');
        echo _('There are') . ' ' . $myrow[0] . ' ' . _('sales orders with this Location code');
    } else {
}
if (!isset($_POST['FromPeriod']) or !isset($_POST['ToPeriod'])) {
    /*Show a form to allow input of criteria for TB to show */
    echo '<table><tr><td>' . _('Select Period From') . ':</td><td><select name="FromPeriod">';
    $sql = "SELECT periodno, lastdate_in_period FROM periods ORDER BY periodno";
    $Periods = DB_query($sql);
    while ($myrow = DB_fetch_array($Periods, $db)) {
        echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
    }
    echo '</select></td></tr>';
    $sql = "SELECT MAX(periodno) FROM periods";
    $MaxPrd = DB_query($sql);
    $MaxPrdrow = DB_fetch_row($MaxPrd);
    $DefaultToPeriod = (int) ($MaxPrdrow[0] - 1);
    echo '<tr><td>' . _('Select Period To') . ':</td><td><select name="ToPeriod">';
    $RetResult = DB_data_seek($Periods, 0);
    while ($myrow = DB_fetch_array($Periods, $db)) {
        if ($myrow['periodno'] == $DefaultToPeriod) {
            echo '<option selected="selected" value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
        } else {
            echo '<option value="' . $myrow['periodno'] . '">' . MonthAndYearFromSQLDate($myrow['lastdate_in_period']) . '</option>';
        }
    }
    echo '</select></td></tr></table>';
    echo '<div class="centre"><input type="submit" name="recalc" value="' . _('Do the Recalculation') . '" /></div>
        </div>
        </form>';
} else {
    /*OK do the updates */
    for ($i = $_POST['FromPeriod']; $i <= $_POST['ToPeriod']; $i++) {
        $sql = "SELECT accountcode,\n\t\t\t\t\tperiod,\n\t\t\t\t\tbudget,\n\t\t\t\t\tactual,\n\t\t\t\t\tbfwd,\n\t\t\t\t\tbfwdbudget\n\t\t\t\tFROM chartdetails\n\t\t\t\tWHERE period ='" . $i . "'";
 $ErrMsg = _('The Inventory Comparison data could not be retrieved because');
 $DbgMsg = _('The following SQL to retrieve the Inventory Comparison data was used');
 $sql = "SELECT stockcheckfreeze.stockid,\n\t\t\t\t\tdescription,\n\t\t\t\t\tstockmaster.categoryid,\n\t\t\t\t\tstockcategory.categorydescription,\n\t\t\t\t\tstockcheckfreeze.loccode,\n\t\t\t\t\tlocations.locationname,\n\t\t\t\t\tstockcheckfreeze.qoh,\n\t\t\t\t\tstockmaster.decimalplaces,\n\t\t\t\t\tbin\n\t\t\tFROM stockcheckfreeze INNER JOIN stockmaster\n\t\t\t\tON stockcheckfreeze.stockid=stockmaster.stockid\n\t\t\tINNER JOIN stockcategory\n\t\t\t\tON stockmaster.categoryid=stockcategory.categoryid\n\t\t\tINNER JOIN locations\n\t\t\t\tON stockcheckfreeze.loccode=locations.loccode\n\t\t\tINNER JOIN locstock\n\t\t\t\tON stockcheckfreeze.loccode=locstock.loccode\n\t\t\t\tAND stockcheckfreeze.stockid=locstock.stockid\n\t\t\tORDER BY stockcheckfreeze.loccode,\n\t\t\t\tstockmaster.categoryid,\n\t\t\t\tstockcheckfreeze.stockid";
 $CheckedItems = DB_query($sql, $ErrMsg, $DbgMsg);
 if (DB_num_rows($CheckedItems) == 0) {
     $Title = _('Inventory Comparison Comparison Report');
     include 'includes/header.inc';
     echo '<p>';
     prnMsg(_('There is no inventory check data to report on'), 'warn');
     echo '<p>' . _('To start an inventory check first run the') . ' <a href="' . $RootPath . '/StockCheck.php">' . _('inventory check sheets') . '</a> - ' . _('and select the option to create new Inventory Comparison data file');
     include 'includes/footer.inc';
     exit;
 }
 $FirstRow = DB_fetch_array($CheckedItems);
 $LocationName = $FirstRow['locationname'];
 DB_data_seek($CheckedItems, 0);
 include 'includes/PDFStockComparisonPageHeader.inc';
 $Location = '';
 $Category = '';
 while ($CheckItemRow = DB_fetch_array($CheckedItems, $db)) {
     if ($Location != $CheckItemRow['loccode']) {
         $FontSize = 14;
         if ($Location != '') {
             /*Then it is NOT the first time round */
             /*draw a line under the Location*/
             $pdf->line($Left_Margin, $YPos - 2, $Page_Width - $Right_Margin, $YPos - 2);
             $YPos -= $line_height;
         }
         $LeftOvers = $pdf->addTextWrap($Left_Margin, $YPos, 260 - $Left_Margin, $FontSize, $CheckItemRow['loccode'] . ' - ' . $CheckItemRow['locationname'], 'left');
         $Location = $CheckItemRow['loccode'];
         $YPos -= $line_height;