Quantcast
Channel: ASPRunner forums
Viewing all 2586 articles
Browse latest View live

Add to fields to make a new field

$
0
0
I have this query and I want to add hour1 + hour2 = thour
Not sure how to do that with AS variables

SELECT
start1,
start2,
stop1,
stop2,
miles,
other,
CONCAT(MOD(HOUR(TIMEDIFF(stop1,start1)), 24)) AS hour1,
CONCAT(MOD(HOUR(TIMEDIFF(stop2,start2)), 24)) AS hour2
FROM daily

Thanks for the help

Sorting Columns - Why Letters Instead of Arrows

$
0
0
I can't figure out where I went wrong. The arrows for sorting data in the columns are Letters instead of arrows. Where do fix this? Also, how do I get rid of the sort criteria in the URL?

Posted Image

Advice on implementing secure 'rolling notes' functionality

$
0
0
Hi all,

I am hoping that someone might be able to give me a steer on the best way of implementing a feature in my app.
The app is essentially a case management system in which a user is required to make notes, which, over time, aggregate into a case history.
I’m planning to implement note entry through a simple rich text editor so the first note that is entered is stored in a single large text field or a blob.
Once a note has been entered, it must be impossible for the user to edit the field - in other words it has to be indelible / read only.
Subsequently, when the case is accessed, the user should be able to scroll through previous notes and then, probably in a text input box below that displayed data, enter new notes.
When the user has completed their new notes they will need to be appended to the main notes field along with a date and time stamp and the name of the user who is currently logged in.
My plan for doing this was going to be as follows:
1) Have a main field in the database to store these text notes - say ‘appnotes’
2) Pre populate that note field on creation with a simple text note which indicates when the notes field was created and then make that field read only.
3) On first submission of a note from within the application, save the entered text in a temporary database field with an appended date stamp, say ‘newnote’. Then make the first field ‘appnotes’ writable, copy the content from the temporary field and append it to ‘appnotes’ and then make ‘appnotes’ read only again. Lastly delete the content of the temporary field ‘newnote’.

Does this seem a reasonable approach or am I over complicating this process? I’m sure that some of you will have seen (and solved!) this problem before.

Any guidance would be very much appreciated,

Cheers Geoff.

sessions not working

$
0
0
I am trying to get session variables to work and I can't get [Orgid] => USAFC21 to default.

I did a snippet with this print_r ($_SESSION);

this is my return

po_add.php [UserID] => Aaron Easton [UserName] => Aaron Lee Easton [GroupID] => -2 [AccessLevel] => User [UserData] => Array ( [ID] => 139 [username] => Aaron Easton [password] => xxxxxxx [email] => aaron.easton@xxxx [fullname] => Aaron Lee Easton [groupid] => -2 [active] => 1 [Region] => TX [Location] => [Postion] => Site Supervisor [LocationID] => 1,2,3,4,5,6,7,8,10,11,12,13,16,17,18,19,20,24,27 [SingleLocationID] => [Program] => 2 [PrPrefix] => CLS [PoPrefix] => CLS [Orgid] => USAFC21 )

After Successful Login

{
$_SESSION["Orgid"] = $data["Orgid"];
}


It returns zero!

Doing Math in PHPRunner

$
0
0
I find it very difficult to do math functions in PHPRunner.

With PHP I would just do:
$total = $hours * $regular;
$tax = $total * $fed
and so forth.
$reguler and $fed are in a different table than $hours

I can then echo them.

I can figure out how to do that with PHPRunner.
If I can do this in events, how would I do that?

Thanks

PHPExcel - PHPspreadsheet Plugins in General

$
0
0
I added a plugin phpspreadsheet to my source folder PHPspreadsheet as PHPexcel is deprecated in 7.0 php. Xlinesoft is still using PHPexcel . I can send emails as attachments from the old PHPexcel but this particular script will not work in PHP 7.0 +

It's actually this line of code that is supposed to open excel in browser for download. won't work in 7.0 with deprecated PHPexcel.

$objWriter->save('php://output'); // does not work with PHPexcel in anything PHP 7.0 or + . Here is an older topic on the same subject but now I need it to go to the browser , which don't work with PHP 7 it seems.


So thinking I can add phpspreadsheet to the source folder in the latest build , I could fix this . NOT


I build my project and the plugin is not there . It seems any custom plugins added to the plugins folder in the source code do not get generated into a project and build. Click Here old topic but should work


So I injected it myself into the output folder but because I get a 500 error on the button handler in debugging can't find params f - ???? proto . Json. If I just send the xlsx file as an email attachment it works perfect.

I have checked in tips and tricks and fhumes has some examples ( but no databases to test them ) great example of pdf files which he is using in a button , but the code if far more than I need and templated. His code does not actually show you how to install the phpspreadsheet unforunately. He uses composer I assume , Can't use this in my situation as one it is way too much time and two not need when the zip file can be extracted and just added to plugins folder and call it using autoloader.

Anyone Ideas ???


10.3 Build 33877
10.3 Build 33978 ( beta )

Error generating window.controlsMap

$
0
0
When generating add and list page of one of my tables i get this code:

add
<script>
window.controlsMap = ;
window.viewControlsMap = {"recetas":{"add":{"1":[]}}};
window.settings = .......
</script>

list
window.controlsMap = ;
window.viewControlsMap = {"recetas":{"list":{"1":{"mViewControlsMap":[]}}}};

In both cases it crashes the page with "Uncaught SyntaxError: Unexpected token ';'" when I debug the page with Chrome developers tools.
This code is generated by phprunner, not included as an event by me.

Any idea what could be the reason?

Thanks in advance!

Help with code in event

$
0
0
Hello, I need some help with this code in the Menu Item: Modify event, this code works:

if ($_SESSION["GroupID"]!="99999999")
{
  $title = $menuItem->getTitle();
  if ($title=="Datos")
     return false;
}
return true;


But this code doesn't work:

if ($_SESSION["GroupID"]!="99999999" or $_SESSION["GroupID"]!="88888888")
{
  $title = $menuItem->getTitle();
  if ($title=="Datos")
     return false;
}
return true;


I have two admin users: 99999999 and 88888888, I want to hide a menu item for all users to except my admins.

What is wrong with my code?

Thanks.

how to select the max date

$
0
0
good day

i have a report with using following sql

SELECT
tblrequisition.OrderConfRefNo,
tblrequisition.OurReferNo,
tblordersupplydetails.SupplierLink,
YEAR(tblordersupplydetails.orderdate) AS `Year`,
MONTHNAME(tblordersupplydetails.orderdate) AS `MONTH`,
MONTH(tblordersupplydetails.orderdate) AS MONTHSORT,
tblship.visible,
tblordersupplydetails.orderdate,
tblship.FullName,
tblordersupplydetails.Curr,
SUM(tblordersupplydetails.ForeignTotal) AS FOREIGNTOTAL,
SUM(tblordersupplydetails.USDTotal) AS USDTOTAL,
tblordersupplydetails.VesselDept,
tblordersupplydetails.Description
FROM tblordersupplydetails
INNER JOIN tblrequisition ON tblordersupplydetails.EnquryLink = tblrequisition.IdCounter
INNER JOIN tblship ON tblrequisition.VesselLink = tblship.ShipCode
WHERE (tblrequisition.OurReferNo ='ATH-SUPPLY-434') AND (tblship.visible =1)
GROUP BY tblrequisition.OrderConfRefNo, tblrequisition.OurReferNo, tblordersupplydetails.SupplierLink, tblordersupplydetails.Description
ORDER BY tblship.FullName, tblrequisition.OrderConfRefNo



and it returns following results


image link

but how to select only these records with max datetime from orderdate i.e. these values with orderdate 2019-09-06 15:34:20


thanks in advance for your help

Freeze column

$
0
0
Is there a way to freeze first column on list page?

Freeze columnist

$
0
0
Is there a way to Freeze first column and first row?

launch an add page (custom view) via a popup from a menu item link

$
0
0
Hi Guys,

Any ideas how to launch an add page (which is a custom view) via a popup from a menu item link.

This view does not have a list page, just an add!

I have attempted multiple version of some of the examples from this cool blog post with mixed results.

If I add this code to my view page's Javascript onload event

Runner.displayPopup( {
url: "products_add.php"
});

It opens 3 popups for the same page.

Any ideas would be much appreciated.

Thanks,
J

update table from List page

$
0
0
How do I update a table from List Page events? for example, I want to calculate the total amount of that day from the amount field and update the same table or another table. Pls, help here.

Changes in Editor that lock out Designer

$
0
0
I discovered a quirk about working with the Editor and the Designer together. Apparently, once you make changes to the HTML in the Editor, any ensuing changes in the Designer do not get included in the build. The designer is effectively locked out for that page.

This has come up for me a couple of times. What I did was to copy and save my html in Notepad, reset the page in Editor, do a build to get the changes made in Designer, and then go back and change the HTML again. So save any HTML tweaking until you are finished in the Designer.

I understand this is an artifact of the sort of in-between state we are in now as we move completely away from the Editor but still need it to accomplish things not yet integrated into the Designer. I'm hoping a permanent solution is on the horizon. The ideal solution for me would be to integrate the CSS and html coding capabilities into the Designer.

[SOLVED] Code Snippet Problem

$
0
0
function distance($lat1, $lon1, $lat2, $lon2, $unit) {
  if (($lat1 == $lat2) && ($lon1 == $lon2)) {
    return 0;
  }
  else {
    $theta = $lon1 - $lon2;
    $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) +  cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta));
    $dist = acos($dist);
    $dist = rad2deg($dist);
    $miles = $dist * 60 * 1.1515;
    $unit = strtoupper($unit);

    if ($unit == "K") {
      return ($miles * 1.609344);
    } else if ($unit == "N") {
      return ($miles * 0.8684);
    } else {
      return $miles;
    }
  }
}

echo distance(32.9697, -96.80322, 29.46786, -98.53506, "M") . " Miles<br>";
echo distance(32.9697, -96.80322, 29.46786, -98.53506, "K") . " Kilometers<br>";
echo distance(32.9697, -96.80322, 29.46786, -98.53506, "N") . " Nautical Miles<br>";

?>


Could inject the code snippet with PHPR built-in CHECK SYNTAX to be okay, yet on testing,
I get an error window, saying, …/include/events.php owns a failure on line 63 which, after
inspection had been showing me that some additional three lines had been added, what do I miss?

Filter Lookup Wizard

$
0
0
I am trying to filter a lookup wizard on an Add page. In the Where portion of the lookup wizard I am putting this:

fleet_link=':user.fleet_id' (this fleet_id field is in the login table I am using).

But it has no effect.

Any help why this doesn't work?

Auto Populating Fields on an 'Add Page' Using Field Event

$
0
0
Hi, I'm new to ASPRunner.net
I've looked through the forum and found a few threads that have similar questions to this, but I cannot seem to find anything that does exactly what I want.
I'm using the latest version of ASPRunner.net

I have an 'add' form adding records to a table and I want to auto populate other fields on the add page when the customer number is entered, before the record is saved.

I've successfully used the 'Autofill' function when setting the customer number as lookup field, however this is proving to be an annoyance to the users as the lookup table has over 400,000 records in it and using the drop-down lookup makes it slower to add a value.

My preference is to have the user enter the customer number, then using a 'Change' field event, have the other fields on the add page auto populated.

I understand I need to create three bits of code (client before, server and client after)… but just cannot seem to get it to work.

The field on the add page is 'CNSHAN' which is the account number

I then want to fetch the account name and branch from another table in the same database. The table is 'F0101' and the fields are 'ABALPH' and 'ABMCU' which is the account name and branch respectively.
The account number on the 'F0101' table is ABAN8, so the data to be fetched would be 'Select ABALPH, ABMCU from F0101 where ABAN8=CNSHAN'
ABAN8 is the primary key for the F0101 table, so only one record would ever be returned.

I then want to auto populate the ABALPH and ILMCU fields on the same add page and allow the user to edit these values if necessary.
I would like the account name to display "Invalid Account Number" if the account number entered is not present in the F0101 table.
It would be awesome if I could disable the 'Save' button if the "Invalid Account Number" message is displayed.

Apologies if this is already covered somewhere
Cheers
Ian

Settings Types

$
0
0
Hello,

Various things can be saved to a "settings" table, like column widths, show/hide options, export field order, etc. When I look at the settings table there is a column called "TYPE". Is there a list somewhere of what each type number refers to?

Thanks,
Tim

Many-to-many relation

$
0
0
Hi.

I have 3 tables: CONTACT, PERSON, CONTACTPERSON

CONTACT: ContactID, ContactName
PERSON: PersonID, Firstname, Lastname, Phone, Email
CONTACTPERSON: CustomerPersonID, ContactFN, PersonFN

Under table CONTACTPERSON, I would like to add several Persons
ADD: PersonID (Store PersonID in database, but Lookup from PERSON Fullname with phone)
List: CONTACTPERSON, I would like to inline edit Phone also)

How can I do this in PHPRunner?

Not show Child tables on the main screen

$
0
0
I have three tables in a One to Many, One to Many relationship. Lets call them Grandparent, Parent and Child. I only want the Main one (GrandParent) to show up on the screen when the user logs in. Then when the user chooses a record from GrandParent it will open all the Parent Records associated. Then the user can choose a record from Parent and all Child records associated with it will open.

I linked them one to many already, but on the main screen, when a user logs in, they see all three tables and can access them. I want the Parent and Child hidden from view and their data can only be gotten to if the user chooses the Grandparent record.

I hope this makes sense.

Thanks
Viewing all 2586 articles
Browse latest View live