Member Avatar

## Stored Procedure ## -- Procedure name: billing_to_invoice_update BEGIN UPDATE accounts.0_debtor_trans SET ov_amount=ov_amount+fee-oldfee WHERE trans_no=encounter AND branch_code=pid; UPDATE accounts.0_debtor_trans_details SET unit_price=fee/units,quantity=units,qty_done=units WHERE debtor_trans_no=encounter AND stock_id=CONCAT(code_type,'/',code); -- gl updates UPDATE accounts.0_gl_trans SET amount=ROUND((-1)*fee) WHERE account=code_type AND memo_=CONCAT(code_type,'/',code) AND last_service_encounter=encounter; UPDATE accounts.0_gl_trans SET amount=ROUND(fee) WHERE account=1100 AND memo_=CONCAT(code_type,'/',code) AND last_service_encounter=encounter; END BEGIN ## Trigger That Calls The above code ## BEGIN CALL billing_to_invoice_update(OLD.pid,OLD.encounter, NEW.units,NEW.fee,OLD.fee,OLD.code_type,OLD.code); END The above scripts shows a trigger and a stored procedure named : billing_to_invoice_update. The purpose is to update changes on one table in another table.data to be updated may be a large array of 10 or more …

Member Avatar
0
9
Member Avatar

CASE WHEN ((SELECT COUNT(id) FROM users) > 0) THEN BEGIN INSERT INTO users(username,password) VALUES('Moshe','Ahuva'); END ELSE BEGIN INSERT INTO users(username,password) VALUES('Zvi','Idan'); END END My aim is to save with a condition. but it fails and says: "Check the manual that correponds to the right syntax near ELSE BEGIN ....". please re-write it better.

Member Avatar
0
13
Member Avatar

SELECT code_type,code,encounter,pid,provider_id,date,CONCAT('code_tye',':','code') INTO @code_type,@code,@encounter,@pid,@povider_id,@date,@standard_code FROM billing FOR EACH ROW BEGIN SELECT procedure_type_id INTO @type_id FROM procedure_type WHERE standard_code='@standard_code' FOR EACH ROW BEGIN INSERT INTO procedure_order(procedure_type_id,date_ordered,provider_id,date_collected,order_priority,order_status ,patient_instructions,patient_id,encounter_id) VALUES('@type_id','@date','@provider_id','@date','high','pending','complaints','@pid','@encounter') END END #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'EACH ROW BEGIN SELECT procedure_type_id INTO @type_id FROM procedure_type WHERE ' at line 2 what is the problem ?

Member Avatar
0
15
Member Avatar

$res=mysql_query("SELECT code_type,code,date,provider_id FROM billing WHERE encounter='$encounter' AND pid='$pid'"); while($row=mysql_fetch_array($res)){ $code_type=$row['code_type']; $code=$row['code']; $date=$row['date']; $provider=$row['provider_id']; $standard_code=$code_type.":".$code; $res1=mysql_query("SELECT procedure_type_id FROM procedure_type WHERE standard_code='$standard_code'"); while($row1=mysql_fetch_array($res1)){ $procedure_type_id=$row1['procedure_type_id']; mysql_query("INSERT INTO procedure_order(procedure_type_id,date_ordered,provider_id,date_collected,order_priority,order_status ,patient_instructions,patient_id,encounter_id) VALUES('$procedure_type_id','$date','$provider','$date','high','pending','$complaints','$pid','$encounter_id')") or die(mysql_error()); } } The above query saves(inserts) more than once in the database. what can be the cause especially in the while loops ? please help me rectify.

Member Avatar
0
18
Member Avatar

function addUsers($params) { $fnameval = $params->getParam(0); $fname = $fnameval->scalarval(); $mnameval = $params->getParam(1); $mname = $mnameval->scalarval(); $lnameval = $params->getParam(2); $lname = $lnameval->scalarval(); if(mysql_query("INSERT INTO users(fname,mname,lname) VALUES('$fname','$mname','$lname')")){ $mess="data and synced successfully";} else{ $mess="data saved but not synced as required";} $response = array('response' => new xmlrpcval($mess, 'string')); return new xmlrpcresp(new xmlrpcval($response, 'struct')); } Look at the above code. I intended to implement XML-RPC(xml remote procedure call) using php. the problem is that it takes time to parse a variable(see peocedure of getting $fname). is there a shorter way i can get the vairables directly e.g $fname=$params['fname'] without getting index then scalarval() ? help. …

Member Avatar
0
15
Member Avatar

I have data that is inserted into a table A. I want that before 'insert' to table A, I should capture Specific data from the array and insert it into table B. Can somebody show me how to do that ?

Member Avatar
0
18
Member Avatar

update drugs,drug_sales SET drugs.b_price=(SUM(drug_sales.fee)/SUM(drug_sales.quantity)) WHERE drugs.drug_id=drug_sales.drug_id AND drug_sales.pid=0 update drugs,drug_sales SET drugs.b_price=SUM(drug_sales.fee)/SUM(drug_sales.quantity) in drugs.drug_id=drug_sales.drug_id AND drug_sales.pid=0 The intention of the above 2 queries is to update a table called drugs based on computational results of table called drug_sales. The two queries fails and the error is: "#1111 - Invalid use of group function". Please help me solve/debug the query. am using mysql DB.

Member Avatar
0
11
Member Avatar

I have a list of columns of table that holds boolean values. consider a,b,c,d,e,f,g,h as column names with **YES** or **NO** values. I want to query and list column names whose value is YES. can some write a mysql query that can list the columns. if a column has an underscore i want to replace underscore with space or " ".can somebody write the required script using php. Thanks for help.

Member Avatar
0
22
Member Avatar

$query = "SELECT encounter,amount1,amount2,posted1,posted2 FROM payments WHERE pid='$patient_id'"; $res = mysql_query($query); $max =25; $num_rows=mysql_num_rows($res); $x_count=0; while($row=sqlFetchArray($res)){ $encounter_id=$row['encounter']; //$method=$row['method']; $amount1=floatval($row['amount1']); $amount2=floatval($row['amount2']); $posted1=floatval($row['posted1']); $posted2=floatval($row['posted2']); $total_amount_paid=floatval($amount1+$amount2+$posted1+$posted2); for($x_count=0;$x_count<$num_rows;$x_count++){ //$encounter_id[$x_count]=$encounter_id; $query = "SELECT date,SUM(fee) AS totalcharges FROM billing WHERE pid='$patient_id' AND encounter=$encounter_id"; $res = mysql_query($query); while($row=sqlFetchArray($res)){ $date_fee=$row['date']; $total_charges=floatval($row['totalcharges']); $balance=floatval($total_charges-$total_amount_paid); $pdf->SetFillColor(254,254,254); $pdf->Ln(); $pdf->SetX(10); $pdf->Cell(50,4,$date_fee,1,0,'L',1); $pdf->Cell(40,4,$encounter_id,1,0,'L',1); $pdf->Cell(40,4,$total_charges,1,0,'L',1); $pdf->Cell(40,4,$total_amount_paid,1,0,'L',1); $pdf->Cell(40,4,$balance,1,0,'L',1);} } } The above code shows my attempt to fetch key called encounter from table called payments. for each encounter, i want to obtain records(many) from another table called billing. i want to sum some values based on an encounter. the above code returns only one row and …

Member Avatar
0
20
Member Avatar

<?php echo "<center><a href='report.php?date_range=$date_range&patient_id=$patient_id&proce_name=$proc_name> <img src='pdf.jpg' alt='Print Lab Resutl' width='32' height='32'>Print Report</a><center> </p></center>";?> I want to submit some the above parameters to the server side script for processing. However, I do dont receive the sent parameters on the server script. can somebody identify and rectify where the error is .I want to retrieve the variables by $_GET method

Member Avatar
0
14
Member Avatar

I am looking for a universal system that can replicate/Synronize database schemas and changed data for mysql,sql server,Oracle or atleast mysql and postgresql. Our company has different branches each with its own local data but any changes in a local database is supposed to be replicated to the central database. The system should also be able to synhronize changes in database schema. Syncronization is two-way i.e the site database should completely sync its data with central database and also receive changes in the central database to local storage. The reason for two-way is to ensure that client data is accessible …

Member Avatar
0
16
Member Avatar

First time click: ![Screenshot-110](/attachments/small/3/Screenshot-110.png "align-right") Second Round Mouse click: ![Screenshot11](/attachments/small/3/Screenshot11.png "align-left") The above images shows screen short of a popup that is shown by clicking on a link from a html table i created using Jquery DataTables plugin and data from mysql database. in essense, when i click the linkable column of a table for the first time, it shows the popup but under the main table.closing the popup and click on the same link again now displays the popup clearly IF I DONT REFRESH THE browser. restarting machine or firefox doesnt help. below is part of css code: <link …

Member Avatar
0
10
Member Avatar

Consider the following code: while($row=mysql_fetch_assoc($result)){ echo '<tr> '; echo '<td><a href="#?id='.$row['id'].'" class="dep_link"><img src="images/icn_edit.png" title="Edit"></a>&nbsp;<a href="#"><img src="images/icn_trash.png" title="Trash"></a></td>'; In my php form, i have created a jquery dialog link such that when the user clicks the 'icn_edit.png' image , a new iframe is loaded with fields for update. i want to pass the 'id' variable from the link of that particular html table row to the division of html where the iframe is created so that i can use it as key for querying database. apparently, the iframe loads but the 'id' is not displayed in the test textfield. how can …

Member Avatar
0
4
Member Avatar

<?php require_once('mail.inc.php'); $con = mysql_connect("localhost","root","12345"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("billtest",$con); $today=strtotime(date("Y-m-d")); $query1="SELECT * FROM ab_transactions_paypal WHERE status=0 AND expiry_date>$today"; $result=mysql_query($query1); if(mysql_num_rows($result)>0){ $count=mysql_num_rows($result); for($j=0;$j<$count;$j++){ $row=mysql_fetch_array($result); $token_id=$row['token_id']; $account_id=$row['account_id']; $sku=$row["sku"]; $inv_id=$row['invoice_id']; $bill_amt=$row['amount']; $cust_email=$row['cust_email']; $url="https://ssl.3gsecure.net/api/payment/checktoken.asp?TransactionToken=$token_id"; $httpRequest_OBJ = new httpRequest($url, HTTP_METH_POST); $result = $httpRequest_OBJ->send(); $mine=$httpRequest_OBJ->getResponseBody(); echo $httpRequest_OBJ->getResponseBody(); $s = explode(";",$mine); foreach($s as $k){ $v=explode("=",$k); $a[$v[0]]=$v[1]; } //print_r($a); echo "<br />"; //echo $a['TransactionStatus']; echo "<br />"; if(($a['TransactionStatus'])==000){ $q_update = "UPDATE ab_transactions_paypal SET status=1 WHERE invoice_id=$inv_id AND account_id=$account_id AND sku='$sku'"; mysql_query($q_update) ; $sql = "UPDATE ab_invoice SET billed_amt=$bill_amt,billing_status=1,process_status=1 WHERE id=$inv_id AND account_id=$account_id AND sku='$sku'"; mysql_query($sql) ; #begin service recharge## $query9="SELECT * …

Member Avatar
0
2
Member Avatar

I want to iterate through html table and display the values. for instance, column keys are fname,lname,mkt,positions. if for instance there are 10 rows,how can i access them and send them to php script ?

Member Avatar
0
6
Member Avatar

function name_loop(){ var names_array = []; $('.name_class').each(function(index){ names_array[index] = $.trim($(this).val()); }); return names_array; } the problem with the above code is that it returns only the first element and not the specified array. can someone solve it for me

Member Avatar
0
3
Member Avatar

consider code below: //Consider the php part(process.php) <table border="1"> <thead> <tr> <th>Name</th> <th>Language</th> </tr> </thead> <tbody> <?php foreach($_POST['names'] as $k=>$v){ ?> <tr> <td><?php echo $v; ?></td> <td><?php echo $_POST['languages'][$k]; ?></td> </tr> <?php } ?> </tbody> </table> //html part**``** <HTML> <HEAD> <TITLE> Add/Remove dynamic rows in HTML table </TITLE> <script type="text/javascript" src="jquery-1.6.2.min.js"></script> <script language="javascript"> function name_loop(){ var names_array = []; $('.name_class').each(function(index){ names_array[index] = $.trim($(this).val()); }); return names_array; } function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var cell1 = row.insertCell(0); var element1 = document.createElement("input"); element1.type = "checkbox"; cell1.appendChild(element1); var cell2 = row.insertCell(1); cell2.innerHTML = …

Member Avatar
0
2
Member Avatar

i have the following query: 1.$query="SELECT * FROM ab_service WHERE account_id=$account_id AND sku='".$sku."'"; 2.$query="SELECT * FROM ab_service WHERE account_id=$account_id AND sku='$sku'"; none of the above seems to work.the problem is with $sku var because when i dont put it as the condition, i get results.what is the problem ? the variable $sku is already asigned from another table.

Member Avatar
0
4
Member Avatar

how can i submit form values to server without refreshing page i.e using ajax.consider fname,lnm,gnd,dpk as sample form fields to illustrate this.

Member Avatar
0
2
Member Avatar

I am trying to process an array to get variable name and its value. below is the code. $s = explode("&",$mine); foreach($s as $k=>$v){ $v=explode("=",$v); for($i=0;$i<count($v);$i++){ $a[$v[$i]]=$v[$i+1]; } print_r($a); } The prolem is that the array repeats itself in output. as shown(look at it keenly): Array ( [APIresult] => 000;APIresultexplnation [000;APIresultexplnation] => Transaction Created;TransactionToken [Transaction Created;TransactionToken] => 79A9DC2A-622B-4334-B610-001F4976C6C0 [79A9DC2A-622B-4334-B610-001F4976C6C0] => ) I want it give variable and value e.g [APIresult] => 000;TransactionToken => 79A9DC2A-622B-4334-B610-001F4976C6C0. The response i.e original string is this: APIresult=000;APIresultexplnation=Transaction Created;TransactionToken=D2AB45E4-1DE7-4828-96CA-3A884697109A This is a response from a third party API. How can i get round this because i …

Member Avatar
0
3
Member Avatar

i have created a php application where am using a barcode scanner to load item name and prices from database. the problem is that once the barcode reader finishes reading the barcode, the details are loaded and it tabs to the next field. this means that the user has to click again on the barcode field to ficus it. how do i prevent the cursor from focusing the next field after scanning i.e focus again on the barcode field after scanning to allow automatic scanning of new item ?

Member Avatar
0
3
Member Avatar

i have created a php application where am using **a barcode scanner to load item name and prices from database**. the problem is that **once the barcode reader finishes reading the barcode, the details are loaded and it tabs to the next field. this means that the user has to click again on the barcode field to ficus it**. how do i prevent the cursor from focusing the next field after scanning i.e **focus again and again on the barcode field only** for faster selling of items ?

Member Avatar
0
2
Member Avatar

hi you all, I am creating an application which requres generation of random keys cosisting of 4 numbers(0-9). However, i realized that at some point,the random numbers repeats themselves. how can i avoid this repetition.the numbers form the primary key of a column in sql database table.

Member Avatar
0
3
Member Avatar

i can create an asp.net application but i don't know how to compile it to run. can somebody help me on how to make it run because at the moment, it runs on visual studio alone. how can i make it run in an environment without vb.net IDE?

Member Avatar
0
2
Member Avatar

Hi brothers,i am creating an application that i want to load a pre-designed crystal report from database records and print it in pdf format and send it as e-mail attachment. I know how to send it as an attachment but i don't know how to print it in pdf automatically for sending. can somebody help me?

Member Avatar
0
3
Member Avatar

i am creating an invoice creation project where every client has a certain date for payment per month. how do i put the system to update next payment date e.g if client x is supposed to pay on 6th every month and has paid for april,the system should automatically update the sql server database to indicate the next pay date to be 6th may?

Member Avatar
0
2
Member Avatar

i have developed a system which needs to process funds transfer using means of mobile phone sms(short message sent). my problem is that i don't know how to intergrate the application with the sms gateway. suppose sms has been sent through the gateway,what will trigger the system to respond since message from phone enters database directly.give me some light on this please!

Member Avatar
0
2
Member Avatar

I have developed a system which should be accessed remotely. the system reads sql credentials from a notepad file to authenticate to the remote sql server. however, when trying to connect, the system says: "request for odbc permission failed". but if i put the application on the client machine together with the application, it connects to the remote machine. what is the cause for failure if the application and the configuration file is put on the server and invoked remotely by creating a short-cut to the application to client machines?

Member Avatar
0
3
Member Avatar

I have developed a system which should be accessed remotely. the system reads sql credentials from a notepad file to authenticate to the remote sql server. however, when trying to connect, the system says: "request for odbc permission failed". but if i put the application on the client machine together with the application, it connects to the remote machine. what is the cause for failure if the application and the configuration file is put on the server and invoked remotely by creating a short-cut to the application to client machines?

0
1
Member Avatar

i have written an application in vb.net 2008 that i want to access a remote database. when it tries to connect, this is the error message: system.data.odbc,system.data,version=2.0.0,culture=neutral,publicToken=b77a5c561934e089 failed what might be the problem? thanks

Member Avatar
0
3

The End.