Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
groupText
03/10/2014
22:02
Avatar
kalofa
New Member
Members
Forum Posts: 2
Member Since:
03/10/2014
sp_UserOfflineSmall Offline

HELP - SOS

I want to see the result of an arithmetic operation between two fields
in this case the sum of the field xx - zz sum field and the result is displayed under the name yy

"groupText" =>array('<b> Movil:{0}</b> -  Deuda: {summaryRound: 2, summaryRoundType = array("xx" - "zz" =>array("yy"=>"SUM")}  '),

all leave here full code

<?php
require_once '../../../jq-config.php';
// include the jqGrid Class
require_once ABSPATH."php/jqGrid.php";
// include the driver class
require_once ABSPATH."php/jqGridPdo.php";
// Connection to the server
$conn = new PDO(DB_DSN,DB_USER,DB_PASSWORD);
// Tell the db that we use utf-8
$conn->query("SET NAMES utf8");

// Create the jqGrid instance
$grid = new jqGridRender($conn);
// Write the SQL Query
$grid->SelectCommand = 'SELECT n_orden,  n_movil, fecha, concepto, debe, haber FROM cuentas_corrientes ';
// set the ouput format to json
$grid->dataType = 'json';
// Let the grid create the model from SQL query
$grid->setColModel();

// Set the url from where we obtain the data
$grid->setUrl('c_2.php');
 
$grid->setGridOptions(array(

    "rowNum"=>10,
    "sortname"=>"n_movil",
    "rowList"=>array(50,100,150),
    "height"=>'auto',
    "footerrow"=>true,
    "userDataOnFooter"=>true,
    "grouping"=>true,
    "groupingView"=>array(
     "groupField" => array('n_movil', 'n_orden'),
     "groupColumnShow" => array(true),
     "groupCollapse" => true,
     "shrinkToFit" => false,  
     "groupText" =>array('<b> Movil:{0}</b> -  Deuda: {summaryRound: 2, summaryRoundType = array("xx" -  "zz"=>array("yy"=>"SUM")}  '),
     "groupDataSorted" => true,
     "groupSummary" => true,
     "groupSummaryPos" => true,  
/*{ groupField: ['Name'], groupColumnShow: [false], groupText: ['<b>{0} - {1} reg(s)</b>'], groupCollapse: true, groupDataSorted: true, groupOrder: ['asc'] }*/
    )
    ));
  
// Change some property of the field(s)
$grid->setColProperty("concepto", array("label"=>"Conceptos", "width"=>250, "align"=>"left", "background"=>"blue"));
$grid->setColProperty("debe", array("label"=>"Debe", "width"=>50, "align"=>"right" ));
$grid->setColProperty("haber", array("label"=>"Haber", "width"=>50, "align"=>"right"));
$grid->setColProperty("n_movil", array("label"=>"Movil", "width"=>20, "align"=>"center"));
$grid->setColProperty("n_orden", array("label"=>"Orden", "width"=>25, "align"=>"center"));
$grid->setColProperty("fecha", array("label"=>"Fecha", "width"=>45, "align"=>"center",
    "formatter"=>"date",
    "formatoptions"=>array("srcformat"=>"Y-m-d H:i:s","newformat"=>"d/m/Y")
 )
);
// Add a summary property to the debe Column
$grid->setColProperty("haber", array("summaryType"=>"sum", /*summaryTpl=>"Sum: {0}",*/ "formatter"=>"number"));
$grid->setColProperty("debe", array("summaryType"=>"sum", /*summaryTpl=>"Sum: {0}",*/ "formatter"=>"number"));
$summaryrows = array("haber"=>array("haber"=>"SUM"));
$summaryrows = array("debe"=>array("debe"=>"SUM"));
$summaryRoundType = array("debe" - "haber" =>array("saldo"=>"SUM"));
$grid->addUserData(array("n_orden"=>"Total Gral:"));

 

// Enjoy

$grid->renderGrid('#grid','#pager',true, $summaryrows, null, true,true);
$conn = null;

?>

21/10/2014
17:55
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

This is for another forum http://www.trirand.net

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
43 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information