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

How copy data from one table to another table

$
0
0
I have a question.
How to copy data from one table to another table. In the data display I would set the button for each record and when the user clicks the button all the data in that line is copied to another table. For example When some job done the data should be copied to the backup table.
thank you

Menu Items Modify Event

$
0
0
I want to dynamically change the title of a menu item and change the link.

When a member is logged in, they will see a menu item on the welcome page called registration. That link goes to the add page.

When the member registers, I want the welcome page menu item to read Registration COMPLETE and link to the list page.

I can only manage to get one of the changes working (only the first one listed). Here is my Menu items Modify event. Thanks for any help.

if (menuItem.getTitle() == "Registration")
{
string sql = "select AddedBy from dbo.Registration where AddedBy='" + XSession.Session["UserID"].ToString() + "'";
XVar rs = tDAL.CustomQuery(sql);
XVar data = CommonFunctions.db_fetch_array(rs);
if (data)
menuItem.setPageType("list"); //works
menuItem.setTitle("Registration COMPLETE"); //ignored
}
return true;

Window Opens really Slow

$
0
0
I have a dilemma, where I have a table called job with the current SQL fields
SELECT
Order_Date,
AttendBy,
End_Date,
File_No,
Job_No,
CustomerId,
CustomerId AS customerPK,
CustomerEmail,
Contract,
Job_Description,
VAT,
Invoice_Printed,
Invoice_Printing_Date,
Invoice_Tax_Date,
Payment_Received,
Job_Finished,
CustomerRef,
Payment_Due_date,
Payment_Date,
Note,
EngineerId,
EngineerId AS PDAAllocation,
EngineerId AS GasId,
LocationId,
LocationId AS locationPK,
LocationId AS SiteEmailAddress,
LocationId AS SitePhoneNumber,
JobTypeId,
Exported,
Logged_By,
ContactEmail,
PhoneNumber,
ResponseCatagories,
CallerName,
CustomerName,
JobSheet,
OrderSiteAddress,
Engineer_Note,
AutoExport,
Line1,
Line2,
Line3,
PostCode,
SLine1,
SLine2,
SLine3,
SPostCode,
Line4,
Line5,
SLine4,
SLine5
FROM job
ORDER BY Job_No DESC


After this I have a Custom View called Invoice Preview whos SQL is this.
SELECT
Job_No,
Job_No AS Invoice,
Job_No AS BasicInvoice,
Job_No AS FullInvoice,
IFNULL((SELECT ROUND(sum(Invoice),2) FROM labour WHERE Job_No = job.Job_No), 0) AS Labsubtotal,
IFNULL((SELECT ROUND(sum(TotalLineValue),2) FROM material WHERE Job_No = job.Job_No), 0) AS Matsubtotal,
IFNULL((SELECT Labsubtotal+Matsubtotal), 0) AS Subtotal,
IFNULL((SELECT Subtotal*VAT/100), 0) AS VATAmount,
IFNULL((SELECT Subtotal+VATAmount), 0) AS Total
FROM job
ORDER BY Job_No DESC

So on the job list clicking on Invoice Preview will show 3 fields Invoice, Basic Invoice and Full Invoice which are set as custom and have this code
if ($value==$data["Job_No"]) $value = "<a target=_blank href=\"Basic_Invoice_view.php?editid1=".$data["Job_No"]."\">".$value."</a>";

These are all custom views again,
Basic Invoice and Invoice display -
SELECT
Invoice_Tax_Date,
Job_No,
Contract,
CustomerRef,
Order_Date,
File_No,
VAT,
IFNULL((SELECT ROUND(sum(Invoice),2) FROM labour WHERE Job_No = job.Job_No), 0) AS Labsubtotal,
IFNULL((SELECT ROUND(sum(TotalLineValue),2) FROM material WHERE Job_No = job.Job_No), 0) AS Matsubtotal,
IFNULL((SELECT Labsubtotal+Matsubtotal), 0) AS Subtotal,
IFNULL((SELECT Subtotal*VAT/100), 0) AS VATAmount,
IFNULL((SELECT Subtotal+VATAmount), 0) AS Total,
CustomerName,
Line1,
Line2,
Line3,
PostCode,
OrderSiteAddress,
SLine1,
SLine2,
SLine3,
SPostCode
FROM job


And full Invoice show -
SELECT
IFNULL((SELECT ROUND(sum(Invoice),2) FROM labour WHERE Job_No = job.Job_No), 0) AS Labsubtotal,
IFNULL((SELECT ROUND(sum(TotalLineValue),2) FROM material WHERE Job_No = job.Job_No), 0) AS Matsubtotal,
IFNULL((SELECT Labsubtotal+Matsubtotal), 0) AS Subtotal,
IFNULL((SELECT Subtotal*VAT/100), 0) AS VATAmount,
IFNULL((SELECT Subtotal+VATAmount), 0) AS Total,
IFNULL((select sum(Working_Hrs) from labour where Job_No = job.Job_No), 0) AS JSH,
Invoice_Tax_Date,
Job_No,
Job_No AS Materials,
Contract,
CustomerRef,
Order_Date,
File_No,
VAT,
CustomerName,
Line1,
Line2,
Line3,
PostCode,
OrderSiteAddress,
SLine1,
SLine2,
SLine3,
SPostCode
FROM job


Now when you click on the Job Number in the Invoice field, a new window opens but it takes about 20 seconds to open the page. Once the page is open if you copy and paste the address URL into a new window, it will open right away.
If I run the same query in phpMyAdmin again it opens within a second, so why does it take so long on a PHP page?

It is running on a Windows SBS2008 under IIS7 and php5
The same happens if I run it on WAMP with php5 and also on a ubuntu machine with php5.
I first thought it was the php version, but I dont have the same problem when running phpMyAdmin, so any pointers on what to look for will be great.
Thanks
Paul.

Remove option based on previous field

$
0
0
Hello,

first of all excuse me if this was answered or documented before, as I didn't find anything of the sorts.

I have two fields, which are different fields in the database as well, both of them are configured with the lookup wizard to load a pre-defined number of options:

Posted Image

Image Link just in case

I dumbed down the example for it to be numbers, let's say you can only choose numbers from 1 to 10.

The first field uploads a number to the database. The second, a list of numbers separated by commas (as I guess is the default behaviour for multiple-selection with the lookup wizard).

What I want:

  • Good: If a number is chosen in the first field, then the user can't choose that same value in the second one. This has to be done dinamically as the user will fill the form in one go.
  • Fantastic: The same but with the reverse order, advancing from the second field to the first. I suspect it's a bit harder as we are dealing with a list.


What is the best way to do this taking advantage of PHPRunner's structure?

Cheers

Display Child Data on Edit Page

$
0
0
On edit page I have a ID , using that ID I want to display all the related data from second table.
I have tested the code that you have in tutorial, but I did not work.

Dashboard Images

$
0
0
I would like to incorporate a front page dashboard which uses images to point to other dashboards/tables.

Can this be done in PHPRunner?

[SOLVED] Auto save if checkbox checked

$
0
0
Hello,

On my add page I want to "auto-save" the record when a text field losses focus, but only if a checkbox field on the same add page has been selected. I use a field event on the text field, which is set to fire on "change", and in the "client after" section I have this code:

------------------------
var ctrlas = Runner.getControl(pageid,'AutoSave');

if (ctrlas.getValue().ToString() == "1") {
$("#saveButton1").trigger('click');
}
------------------------

But this doesn't seem to work. Can anyone see what I'm doing wrong?

If I just have the auto-save code (i.e. $("#saveButton1").trigger('click'); ) it works, so it seems to be something with the "if" statement.

Thanks,
Tim

Popup Edit forms do not close on Save

$
0
0
I don't understand some popup form behaviors in PHPRunner [9.8 (29967 x64)]

I will also preface this with "I am not exactly new to PHP, but am new to PHP Runner. I have only used PHPRunner for the last 15 days." (albeit 6-8 Hrs a day) and have created an incredibly powerful app in a very short time. These Forums have been very helpful and PHPRunner rocks! :D


My problem:
Two tables: Client and Users.

Both Edit record settings are set to "return to the list page" "After record is updated".

Both Edit record pages open as as popups from the appropriate list page.

Client 'edit record' popup form closes on "Save" and updates the record appropriately.


User 'edit record' popup form does NOT close on "Save", however the User record is updated.
The save button is grayed and the cursor shows the red "no" icon for the button, preventing the user from clicking it again.
The user is forced to "X-out" the form or click the "Cancel" button.

This behavior confuses the users "Did it save?"


I thought at first maybe my "After record updated" code created the issue [SQL UPDATE query to place timestamp in another table], but running the app without the SQL code does not affect the behavior. The popup form does not close, but does update the User table record.

Am I missing some setting somewhere?

...{wonk}

Customize import page

$
0
0
Hi,
How i can customize import page. I want disable copy paste button, disable check box of column names, disable possibility of change columns.
Thanks
Regards
Rimantas
:rolleyes:

customize maps

$
0
0
Hi,
How i can customize map height by screen height. I tried with screen.height, but i don't found a way how do that.
Next i need put a labels from db with points on map.
Thank for you help.
Regards
Rimantas

Edit user button/menu?

$
0
0
Is it possible to edit the user button / menu that appears in the upper right corner of apps? I have a user profile that includes additional information than what gets pulled in from AD and that would be the perfect place to link to it. Currently in AD mode, it only has one menu item which only applies to admins ("Admin area"). I'd like to add an additional entry for "My profile" and link it to the page I set up for this purpose?

Anyone know if this is possible?

Text color formating based on the value

$
0
0
Hi ,
I need to have different text colors in a column based on the value on the list page.
The column name is Warhouse_id and the values are 14, 15, 51 ,72
Each value should have a different color. I tried to used "view as" -custom option and C# without success.
Can someone help me please ?

Thx

Email - New Data , CC, BCC, HTML

$
0
0
On event options, send email with new data, how I can add CC,BCC to the email function? Also, I want to use some html/table code for the budy section. How I can do that?

login page background

$
0
0
I put the code to change background Login page, but do not work, and also want to know to to change panel color or make transperent??
p.s.: the same code worked to Body of otheres pages.

here is the code that I used...

/* login page background */
body.function-login
{
height:100%;
background:transparent url(../images/Background_1024.png) no-repeat center center fixed;
background-size:cover;
}

Inserting into another table

$
0
0
I would like to add the id of the record I'm adding to a field in another table but am not getting any joy is this the correct way to do it? I've tried 2 ways to do it without any luck

global $dal;
$tblEvents = $dal->Table("Property_Landlord_Tenant_Link");
$tblEvents->Value["PLT_P_id"]=$values['P_id'];
$tblEvents->Add();

$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ($values[P_id])";
CustomQuery($sql);

Any ideas?

I can add it when done through phpadmin using a hard-coded value

Multiple queries on one page - code level

$
0
0
Hello,

I am trying to get multple quires result on one list page.
In "function On()" i need more than one query to be triggered before i can do an update or insert into another table.

Inserting isn't the issue.

I am getting a $record from $button->getCurrentRecord() but after that i need to check the state in different table which has no direct connection to the curent data set / table shown on the list page.

The clasic apporach would be to write a query and trigger it with CustomQuery($sql);

for example :

$sql = "SELECT * FROM users';
$result = CustomQuery($sql);
$result_array = [];

while($row = mysql_fetch_array($result))
{
$result_array[] = $row;
}


now, the question is how to go trough the $result variable?
Tryed clasic PHP mysql_fetch_object and var_dump-ing but no succes.

As i need to get the result from that query so i could do an insert/update on an other table.


Any suggestions or examples for this case?

Thank you

Search results

$
0
0
So I have a page designed with search arguments. The Search results in a list page with matching items. When I click on the item I want...how to I specify what page I want to go to?
Newbie here: been thrashing on this for a while.
Ron

Popup window - How to control size, margins and etc

$
0
0
Hi guys.
I would like to know how can I control some aspects of a popup window (like size, margins, borders, header etc).Any tips?
Thanks in advance,

Marcelo

how to validate if new photo is uploaded

$
0
0
Hi Experts,

I have two fields in a table holding the filenames of uploaded Pictures.
foto1 and foto2 (string fields)
Tablename bildata.

Each Photo's filename is renamed on the fly to recordnumberfoto1 and recordnumberfoto2 (ex. 1051foto1.jpg and 1051foto2.jpg)

On the add page (event before record added)
string sql = "SELECT MAX(bilid) as c FROM bildata";
XVar rs = tDAL.CustomQuery(sql);
XVar data = CommonFunctions.db_fetch_array(rs);
int rnoo = data["c"] + 1;
values["glpris"] = values["detailprisimo"];
if (!values["foto1"])
{
}
else
{
var fileArray = MVCFunctions.my_json_decode(values["foto1"]);
for(int i = 0; i < fileArray.Count(); i++)
{
var fileName = fileArray[i]["name"];
var newFileName = String.Format("files/{0}{1}.jpg", Convert.ToString(rnoo).ToLower() + "foto1", i);
System.IO.File.Move(MVCFunctions.getabspath(fileName), MVCFunctions.getabspath(newFileName));
fileArray[i]["name"] = newFileName;
}
values["foto1"] = Convert.ToString(rnoo).ToLower()+ "foto10.jpg";
}
if (!values["foto2"])
{
}
else
{
var fileArray = MVCFunctions.my_json_decode(values["foto2"]);
for(int i = 0; i < fileArray.Count(); i++)
{
var fileName = fileArray[i]["name"];
var newFileName = String.Format("files/{0}{1}.jpg", Convert.ToString(rnoo).ToLower() + "foto2", i);
System.IO.File.Move(MVCFunctions.getabspath(fileName), MVCFunctions.getabspath(newFileName));
fileArray[i]["name"] = newFileName;
}
values["foto2"] = Convert.ToString(rnoo).ToLower()+ "foto20.jpg";
}

adding records and uploads on addpage Works fine.


On the editpage i have problems!
In before record update event i have:

if (values["foto1"].ToString() != oldvalues["foto1"].ToString()) //means record changed??
{
if (!values["foto1"]) //foto1 is deleted
{
System.IO.File.Delete(MVCFunctions.getabspath(oldvalues["foto1"])); // delete photofile on server to
}
else //foto is changed - new are uploaded
{
var fileArray = MVCFunctions.my_json_decode(values["foto1"]);
for(int i = 0; i < fileArray.Count(); i++)
{
var fileName = fileArray[i]["name"];
var newFileName = String.Format("files/{0}{1}.jpg", XSession.Session["tempbilid"].ToString() + "foto1", i);
System.IO.File.Delete(MVCFunctions.getabspath(newFileName)); // delete old foto i files folder
System.IO.File.Move(MVCFunctions.getabspath(fileName), MVCFunctions.getabspath(newFileName));
fileArray[i]["name"] = newFileName;
}
values["foto1"] = XSession.Session["tempbilid"].ToString() + "foto10.jpg"; //save new foto i table field
}
}
if (values["foto2"].ToString() != oldvalues["foto2"].ToString()) //means record changed
{
if (!values["foto2"]) //foto1 is deleted
{
System.IO.File.Delete(MVCFunctions.getabspath(oldvalues["foto2"])); // delete photo on server to
}
else //foto is changed - new are uploaded
{
var fileArray = MVCFunctions.my_json_decode(values["foto2"]);
for(int i = 0; i < fileArray.Count(); i++)
{
var fileName = fileArray[i]["name"];
var newFileName = String.Format("files/{0}{1}.jpg", XSession.Session["tempbilid"].ToString() + "foto2", i);
System.IO.File.Delete(MVCFunctions.getabspath(newFileName)); // delete old foto i files folder
System.IO.File.Move(MVCFunctions.getabspath(fileName), MVCFunctions.getabspath(newFileName));
fileArray[i]["name"] = newFileName;
}
values["foto2"] = XSession.Session["tempbilid"].ToString() + "foto20.jpg"; //save new foto i table field
}
}

If no Photos in foto1 and foto2 and i upload foto1 - it Works!
If only foto2 are uploaded the foto1 file are also deleted meaning the if (values["foto1"].ToString() != oldvalues["foto1"].ToString()) return true even if i dont change the content of foto1!!

How to know if only foto2 are changed/deleted/new upoload and not foto1 ??

Best regards and thanks in advance

Michael

Add Primary Key to another table

$
0
0
I'm using the after record added event trying to add the primary key to another table but it fails. I can add any other field but the primary key doesn't want to work. I've so far tried:

$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ($values[P_id])";
CustomQuery($sql);


$sql = "INSERT INTO Property_Landlord_Tenant_Link (PLT_P_id) values ($keys[P_id])";
CustomQuery($sql);

I can hard code a value and that workss but need $values[P_id] or $keys[P_id] to work.
Viewing all 2520 articles
Browse latest View live