PHP - Foreach Looping Through Grouping Of Ids In Array
Hello all..
This one's sort of difficult to explain, but yet it should be a pretty simple solution.. What I'm trying to do is loop through an array that has either single event id's or a group of event id's, and run a condition on the change of id's while looping.. Sort of grouping each set if unique id's within a new event section.. Here's sort of a test code I put together: Code: [Select] <?php $result = array( array('event_id' => 70), array('event_id' => 70), array('event_id' => 70), array('event_id' => 95), array('event_id' => 96), array('event_id' => 97), array('event_id' => 98), array('event_id' => 99), array('event_id' => 145), array('event_id' => 145), array('event_id' => 145), array('event_id' => 145), array('event_id' => 166), array('event_id' => 166), array('event_id' => 177), array('event_id' => 200), array('event_id' => 200), array('event_id' => 200) ); $previous_id = ''; foreach($result as $row){ if ($row['event_id'] != $previous_id) { echo '<div style="background:#ccc;">New Event</div>'; } if ($previous_id > 0 && $row['event_id'] != $previous_id) { echo '<table border="1"><tr><td>'.$row['event_id'].'</td></tr></table>'; $previous_id = ''; } else { echo $row['event_id'].'<br />'; $previous_id = $row['event_id']; } } ?> It's about half way working, but there are issues when the ids change and they are either single event ids in a row, or multiple same event ids in a row.. I can't think how to set the $previous_id variable properly on each loop.. Well, figured I'd throw it out there and see what happens.. Thanks.. Similar TutorialsI'm trying to figure out what I'm doing wrong. For each recipient it runs each value which is an integer through the getUserByUserID function to verify that no values inside of the array are non users. But here's the part I'm not sure of and that's the if $recipient or $sender == FALSE. If ANY of the values are found to be non values then I want that if statement to activate. Code: [Select] foreach ($this->input->post('recipient[]') AS $recipient) { $this->users->getUserByUserID($recipient); } $sender = $this->users->getUserByUserID($this->input->post('sender')); // Verifies users were returned from database if (($recipient == FALSE) || ($sender == FALSE)) { // Users was not found in the database $outputArray['message'] = 'Either the recipient or yourself could not be found in the database!'; } Hi Guys I have never reall worked with xml and im stuck. I am gathering data from a class. include "example/class.php"; $data = new Class; $request = $data->List_Accounts(); $res = $data->run_xml($request); echo "<pre>"; print_r($res); echo "</pre>"; Ok so this is the output i get from the print_r(); <pre><!--?xml version="1.0" encoding="utf-8"?--> <rpc request_id="43535"> <response code="0" text="OK"> <account datatype="list"> <name datatype="username">arf34</name> <type datatype="account_type">3</type> <descr datatype="string">Linux Virtual Hosting</descr> <server datatype="int">35</server> </account> <account datatype="list"> <name datatype="username">awecerfewve</name> <type datatype="account_type">3</type> <descr datatype="string">Linux Virtual Hosting</descr> <server datatype="int">34</server> </account> </response></rpc></pre> How could i them loop through this data and pull out certain types like username and account_type using a foreach loop???? Can anyone please help with this. Thanks $array = array("1","2","3"); foreach ($array as $value){ echo $value; } Put its only echoing out 3, not the whole array. hi there. i have a class that queries my db, creates an array objects representing a collection of the items returned. when i pass the array back to the caller and then try to loop through the array, it keeps displaying the same record - i think it's the last record that is displayed however, when i try the same code in the class, it prints out each unique record. i tried doing a reset(myarray); on the caller but that dind't work either. any suggestions? here's the code to loop through the array: if ( count( $myarray ) > 0 ) { //reset($lineItem_array); foreach ( $myarray as $lineitem ) { echo($lineitem->getName()."~"); echo($lineItem->getOId()."~"); echo($lineItem->getProduct()."~"); echo($lineItem->getPIP()."~"); echo($lineItem->getQuantity()."~"); } } } } Is there a nicer, cleaner more efficient and less code way of achieving this?
I have an array of rows from the database and 2 of the columns could have either of 2 values which give me 4 possibilities.
I want to loop through each of them and assign the row to one of 4 arrays so they are all separated out.
This is what i have so far. Haven't tested it yet but the theory makes sense.
if(!empty($rows)) { foreach($rows as $key => $row) { switch($row['type']) { case 'post': switch($row['archived']) { case 0: $array1[$key] = $row; break; case 1: $array2[$key] = $row; break; default: } break; case 'event': switch($row['archived']) { case 0: $array3[$key] = $row; break; case 1: $array4[$key] = $row; break; default: } break; default: } } } Im trying to assign and update table rows with a random 9 character string but am receiving the error : Fatal error: Cannot redeclare make_seed() (previously declared in ... How can I clear/reset the value before the next loop Code: [Select] else { while ($data=mysql_fetch_array($users)){ $user=$data[user]; $usersarray = array($users); foreach ($usersarray as $key => $u){ //clear pass $token = ""; srand(); //generate new password $password_length = 9; function make_seed() { list($usec, $sec) = explode(' ', microtime()); return (float) $sec + ((float) $usec * 100000); } srand(make_seed()); $alfa = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM!@#$%^&*(){}[]"; for($i = 0; $i < $password_length; $i ++) { $token .= $alfa[rand(0, strlen($alfa))]; } // insert password // setup SQL statement $SQL = " UPDATE data SET pass='$token' WHERE user='$m1' "; // execute SQL statement $makeit = mysql_db_query($userdb,"$SQL",$usercid); // check for error if (!$makeit) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } I have multiple arrays containing data for each entry. What I am trying to do is group each item in the array by the date which is also in an array. Where do I start?? Code: [Select] array 'pubDate' => string 'Mon, 15 Feb 10 00:00:00 +0000' (length=29) 'title' => object(SimpleXMLElement)[6] 'description' => object(SimpleXMLElement)[7] 'guid' => string 'http://www.dailyinfo.co.uk/events.php?colname=Events&period=7&eventday=25&eventmonth=9&eventyear=2010#72741' (length=107) 'link' => string 'http://www.dailyinfo.co.uk/events.php?colname=Events&period=7&eventday=25&eventmonth=9&eventyear=2010#72741' (length=107) array 'date' => array 0 => string '2010-09-25T01:00:00+01:00' (length=25) 1 => string '2010-10-02T01:00:00+01:00' (length=25) ------------------------------------------------------------------------------------------------------------------- array 'pubDate' => string 'Fri, 26 Feb 10 00:00:00 +0000' (length=29) 'title' => object(SimpleXMLElement)[5] 'description' => object(SimpleXMLElement)[8] 'guid' => string 'http://www.dailyinfo.co.uk/events.php?colname=Events&period=7&eventday=1&eventmonth=10&eventyear=2010#73266' (length=107) 'link' => string 'http://www.dailyinfo.co.uk/events.php?colname=Events&period=7&eventday=1&eventmonth=10&eventyear=2010#73266' (length=107) array 'date' => array 0 => string '2010-09-25T01:00:00+01:00' (length=25) 1 => string '2010-09-30T01:00:00+01:00' (length=25) ------------------------------------------------------------------------------------------------------------------- Hello all, Need a little help with grouping and summing using an array. I can't do this directly from the database because the vendor package we are using (Tivoli Data Warehouse) stores date in a proprietary format as a CHAR in the database and in GMT so I have to get the data first and then manipulate the date to get it human readable and in the right EST date. I have my query (and my date conversion) from the database returning the data in a format that looks like this: The reason each date has the service repeated is because it was selected from the database by hour (needed to convert Tivoli's weird timestamp and use of GMT) Service TX_Count Date ------------------------------------------------------------------------------------------- Service1 23451 2010-01-01 Service1 93874 2010-01-01 Service1 82363 2010-01-01 Service1 56245 2010-01-02 Service1 73453 2010-01-02 Service1 18965 2010-01-02 I have successfully gotten the data in to an array and I can group by date and then sum the tx_count, or I can group the services and sum the tx_count. What I really need to be able to do is to get the transaction counts by service by day so that I would get something like this as a result Service1 2010-01-01 199688 Service1 2010-01-02 148663 So I need to group by service and then date and then sum it all out of the array. Any advice and direction is appreciated I'm using smarty and php to collect parameters from a user defined tag in cmsms that looks like this... Code: [Select] {schedule date="2010-11-13" time="7:05 p.m." location="Evansville" home="Oakland City" vs="Evansville" winner="University of Evansville" results="82-42"} {schedule date="2010-11-15" time="7:00 p.m." location="Oakland City" home="Oakland City" vs="OSU-Lima" winner="OSU-Lima" results="68-67 2OT"} etc... As you can see each {schedule tag above has the same home="" value. Thats because its schedule dates just for THAT team (i.e. Oakland City). So I may have 10 of these tags on the same page. But I also have other places where the schedule tag is used with a different $home name for another team. So basically I'm calling ALL these schedule tags into one for loop like this... Code: [Select] for ($i=0; $i < count($params['date']); $i++) { $date= $params['date']; $time=$params['time']; $location= $params['location']; $home= $params['home']; $vs= $params['vs']; $winner= $params['winner']; $results= $params['results']; $gameinfo = array("date", "time","location","home","vs","winner","results"); $game_info = compact($gameinfo); } All I want to do is spit back out the total wins for each $home team. I am pulling out my hair out trying to get this thing to work but no luck yet, even though I see a little light. This is what I got so far... Code: [Select] for ($i=0; $i < count($params['date']); $i++) { $date= $params['date']; $time=$params['time']; $location= $params['location']; $home= $params['home']; $vs= $params['vs']; $winner= $params['winner']; $results= $params['results']; $gameinfo = array("date", "time","location","home","vs","winner","results"); $game_info = compact($gameinfo); if($home == $winner) { $wins = array('team' => $winner, 'win' => count($winner)); } } $smarty->append('mwins',$wins); print '<pre>'; print_r($wins); print '</pre>'; and I get this... Code: [Select] Array ( [0] => Array ( [team] => Oakland City [win] => 1 ) [1] => Array ( [team] => Oakland City [win] => 1 ) [2] => Array ( [team] => Oakland City [win] => 1 ) [3] => Array ( [team] => Oakland City [win] => 1 ) [4] => Array ( [team] => Oakland City [win] => 1 ) [5] => Array ( [team] => Oakland City [win] => 1 ) [6] => Array ( [team] => Oakland City [win] => 1 ) [7] => Array ( [team] => Oakland City [win] => 1 ) [8] => Array ( [team] => Oakland City [win] => 1 ) [9] => Array ( [team] => Oakland City [win] => 1 ) [10] => Array ( [team] => Oakland City [win] => 1 ) [11] => Array ( [team] => Oakland City [win] => 1 ) [12] => Array ( [team] => Oakland City [win] => 1 ) [13] => Array ( [team] => Oakland City [win] => 1 ) [14] => Array ( [team] => Oakland City [win] => 1 ) [15] => Array ( [team] => Oakland City [win] => 1 ) [16] => Array ( [team] => Oakland City [win] => 1 ) [17] => Array ( [team] => Southern Indiana [win] => 1 ) [18] => Array ( [team] => Southern Indiana [win] => 1 ) [19] => Array ( [team] => Southern Indiana [win] => 1 ) [20] => Array ( [team] => Southern Indiana [win] => 1 ) [21] => Array ( [team] => Southern Indiana [win] => 1 ) [22] => Array ( [team] => Southern Indiana [win] => 1 ) [23] => Array ( [team] => Southern Indiana [win] => 1 ) [24] => Array ( [team] => Southern Indiana [win] => 1 ) [25] => Array ( [team] => Southern Indiana [win] => 1 ) [26] => Array ( [team] => Southern Indiana [win] => 1 ) [27] => Array ( [team] => Southern Indiana [win] => 1 ) [28] => Array ( [team] => Southern Indiana [win] => 1 ) [29] => Array ( [team] => Southern Indiana [win] => 1 ) [30] => Array ( [team] => Southern Indiana [win] => 1 ) [31] => Array ( [team] => Southern Indiana [win] => 1 ) [32] => Array ( [team] => Southern Indiana [win] => 1 ) [33] => Array ( [team] => Southern Indiana [win] => 1 ) [34] => Array ( [team] => Southern Indiana [win] => 1 ) [35] => Array ( [team] => Southern Indiana [win] => 1 ) [36] => Array ( [team] => Southern Indiana [win] => 1 ) [37] => Array ( [team] => Southern Indiana [win] => 1 ) etc... I want to take all the [win] values for each [team] and add them up this way my final array looks like this... Code: [Select] Array ( [0] => Array ( [team] => Oakland City [win] => 18 ) [1] => Array ( [team] => Southern Indiana [win] => 24 ) I know I'm so close but don't know how to solve the condition I need. Any suggestions would be great!!! bh I'm not sure if the title explains it very well, but here is an image of it. I am trying to figure out how to access the option selected (equal, not equal, etc.), along with its input box, for each column (the checkboxes on the right) selected. The purpose of this is to allow a non-programming administrator user to create a custom query to access information. I can find out which checkboxes are selected no problem, but finding the accompanying drop-down option and input box is difficult for me. How do I do this? If you have a suggestion on how to change it, I'm very open. Thank you in advance! Code: [Select] if(!isset($_POST['submit'])) { echo " <form method='post'> <table> <tr> <td valign='top'>SELECT</td> <td valign='top'> <table>"; // LIST ALL COLUMNS IN A TABLE $result = mysql_query("SELECT * FROM table_name") or die(mysql_error()); $rowcount=mysql_num_rows($result); $y=mysql_num_fields($result); for ($x=0; $x<$y; $x++) { echo " <tr> <td> <input type='checkbox' name='fields[]' value='".mysql_field_name($result, $x)."'>".mysql_field_name($result, $x)." </td> </tr>"; } echo " </table> </td> <td valign='top'>FROM allocations</td> <td valign='top'>WHERE</td> <td> <table>"; // LIST ALL COLUMNS IN A TABLE $result = mysql_query("SELECT * FROM table_name") or die(mysql_error()); $rowcount=mysql_num_rows($result); $y=mysql_num_fields($result); for ($x=0; $x<$y; $x++) { echo " <tr> <td> <input type='checkbox' name='column[]' value='".mysql_field_name($result, $x)."'>".mysql_field_name($result, $x)." </td> <td> <select name='operator[]'> <option value='='>equals</option> <option value='<>'>does not equal</option> <option value='>'>greater than</option> <option value='<'>less than</option> <option value='>='>greater than or equal to</option> <option value='<='>less than or equal to</option> <option value='LIKE'>is like</option> </select> </td> <td><input type='text' name='criteria[]'></td> </tr>"; } echo " </table> </td> <td valign='top'><input type='submit' value='Process Query' name='submit' class='submit'></td> </tr> </table> </form>"; } else { echo "<b>Fields to edit:</b> "; foreach ($_POST['fields'] as $fields) { echo $fields,", "; } echo "<br><br>"; echo "<b>Columns to query:</b> "; foreach ($_POST['column'] as $columns) { echo $columns," HERE IS THE SPOT, "; } } Hello all. How would I loop through this array and find each "DTM" value? I want to be able to loop thru this array so that I can determine when to add 123, 456, ... 789, 1012 ... 123, 456 to a database. Hope this makes some sense... Thanks for any help on this one. Code: [Select] <?php $aryValues = array('DTM', '123', '456', 'DTM', '789', '1012', 'DTM', '123', '456'); ?> I've got a data array that looks like this: $arraylist = ('00101001','10001010','00010100','01100101'); And another that looks like this: $arrayposition = (0,3); The idea is to loop through $arraylist and when the loop gets to the indexes/positions listed in the $arrayposition array, to change all of the 1's to 0's, then put the values back into a string variable. I have something like this at the moment: $chores = 1; $arraylist_new = ''; foreach ($arrayposition as $value) { if ($chores != '') { $oldvalnum = 0; foreach($arraylist as $string) { if ($value == $oldvalnum) { $string = str_replace("1", "0", $string); if ($arraylist_new == '') {$arraylist_new = $string;} else {$arraylist_new .= ', ' . $string;} } else { if ($arraylist_new == '') {$arraylist_new = $string;} else {$arraylist_new .= ', ' . $string;} } $oldvalnum++; } } } echo $arraylist_new; The idea is for the output to be: 00000000, 10001010, 00000000, 01100101. I know the code is hinda hectic, but could someone please help?? Thanks in advance! <?php $_SESSION["cart_item"] = array( 'cart_item' => array( 'id' => $id, 'product_name' => $product_name )); } $cart_items = $_SESSION["cart_item"]; foreach ($cart_items as $cart_item) { echo $cart_item["id"] . $cart_item["product_name"]; } ?>
I have tried several variations of the foreach loop like the one above and I mostly get the error message: Notice: Array to string conversion. When I use: I get the following output: array(1) { ["cart_item"]=> array(2) { ["id"]=> array(2) { [0]=> string(1) "2" [1]=> string(1) "3" } ["product_name"]=> array(2) { [0]=> string(19) "Adult Female Bike" [1]=> string(18) "Kids Unisex Bike" } } } I have a array as follows and I want to look by key where the key is 'ABCD', 'EFGH', etc.. I am using foreach but it is not working. How can I accomplish this? Code: [Select] Array ( [0] => Array ( [ABCD] => Array ( [venue_id] => 1003 [has_dining] => X [table_count] => 0 [serves_alcohol] => X ) ) [1] => Array ( [EFGH] => Array ( [venue_id] => 1003 [has_dining] => X [table_count] => 0 [serves_alcohol] => X ) ) ) Hello, I'm taking values for various cities/areas my members live in. One member can be placed in many cities and on registering they are required to input one city but are allowed to enter a maximum of 6 cities. So, from my posted form I have; //member ID (numeric) $MemID; $City=$_Post['City']; $City2=$_Post['City2']; $City3=$_Post['City3']; $City4=$_Post['City4']; $City5=$_Post['City5']; $City6=$_Post['City6']; Where $City must be set, but any of the other $City'x' may or may not be empty. There are two tables, 1) Cities (CityID,City) 2) Mem-Cities (MemID,CityID). I have some SQL statements which check if the city exists and if it doesn't inserts it. Then adds the $MemID to that $CityID. The way im doing this now is not very efficient like this; if(!empty($City)) { $sql="SELECT COUNT(City) AS Count FROM Cities WHERE City='$City'"; $query=mysql_query($sql); $row=mysql_fetch_array($query); if($row['Count'] == 0) { $insert="INSERT INTO Cities (City) VALUES ('$City')"; mysql_query($insert) OR die('<h1>There was an error adding into Cities</h1>' .mysql_error()); //inserting additional City } $insert="INSERT INTO Mem-Cities (MemID,CityID) SELECT '$MemID',CityID FROM Cities WHERE City='$City' LIMIT 1"; mysql_query($insert) OR die('<h1>There was an adding additional City Cities to members</h1>' .mysql_error()); //inserting additional city into Cities to Members } And repeating the code above for each city. How can I loop through each city and optimise this code? Steps 1) if $City'x' is not empty and doesn't exist in DB insert it 2) add the $MemID to that CityID Thanks! hello freaks,
I have a four-element array, which is the result of a mysql query. The array is like below. (This is of course just a snippet to show the structure; the hours of course go up to 24, then repeat; there are about ten days' worth of data.)
Array ( [dayname] => day1 [hour] => 1 [widtype] => type1 [Output] => 20 ) Array ( [dayname] => day1 [hour] => 2 [widtype] => type1 [Output] => 9 ) Array ( [dayname] => day1 [hour] => 1 [widtype] => type2 [Output] => 450 ) Array ( [dayname] => day1 [hour] => 2 [widtype] => type2 [Output] => 650 ) I want to loop through this data and output each hour's data in a separate line, like below (I included the headings just for clarity): Day Hour Type1_total Type2_total day1 1 20 450 day1 2 9 650 ... and can't seem to make this happen. Here's the code I've written: $prevday = ''; while ( $row = mysql_fetch_assoc($result)) { extract($row); $currentday = $row['dayname']; $currenthour = $row['hour']; $currentwid = $row['widtype']; while($currentday !== $prevday){ for($currenthour = 1; $currenthour <=24; $currenthour++){ if($row['widtype'] == 'type1'){ $type1_total = $row['Output'];} if($row['fuel'] == 'type2'){$type2_total = $row['Output'];} print "<pre>"; echo "$currentday, $currenthour, $type1_total, $type2_total"; print "</pre>"; } $prevday = $currentday; } }... and here's what it outputs: day1, 1, 20, , day1, 2, 20, , Clearly I have written this loop wrong but have banged my head against it for a while and wonder if it's just not possible to do what I want. Any suggestions would be hugely appreciated! Hi all,
I have a looping error in my PHP.
I am trying to add use a while statement to gather the users first and last name in to a string, add them to an array called $friendname, then check that the $friendname[] is only output/echoed once.
At the moment the code looks good to me but with multiple rows with the same name associated, the name is echoed the same amount of times as rows, instead of once as it is supposed to be.
Any ideas anyone?
while($row2 = mysqli_fetch_assoc($result2)) { $friendcode = $row2['Code']; $names = "SELECT FirstName, LastName from users WHERE Code = '$friendcode' AND Code != '$crewcode'"; $resultnames = mysqli_query($cxn,$names) or die ("Can't get friends names."); while($rownames = mysqli_fetch_assoc($resultnames)) { $friendname = array(); $newfriendname = ($rownames['FirstName'].' '.$rownames['LastName']); if (!in_array($newfriendname, $friendname)) { array_push($friendname, "$newfriendname"); echo $newfriendname; } } } I have an array which I contains multiple arrays, I would like to loop through and run a function on a certain key within the array I have the following code which works but I was wondering if there was a better method? $i = 0; foreach($Items as $Item) { $Items[$i]['key'] = custom_function($Item['key']); $i++; } The array $Items structure is as follows Code: [Select] array ( [0] => array ( [key] => 'blah' ) [1] => array ( [key] => 'blah' ) [2] => array ( [key] => 'blah' ) ) Hi everyone, I am very new to PHP and trying to learn so please bear with me. I have a simple form which passes fields to a PHP script: <form method="post" action="cartaction.php"> <p> <input type="submit" name="submit" value="Buy" /> <input type="hidden" name="cartaction" value="add" /> <input type="hidden" name="item" value="steelcasserole" /> </p> </form> I am trying to produce a shopping cart type page which will display the item(s) purchased. The problem is I have more than one submit button on the page for different products but with the same fields. I have tried to create the cartaction.php script to save the information from the form in a session variable which will allow me to output the item(s) purchased into this page prior to sending everything to a checkout page. I can get the information to appear for a single item but the problem is I want to output the details for each product added to the cart. At the moment, when I go back to the products page and try to add a new item to the shopping cart it just replaces the previous item that was there rather than retaining it and adding a new item underneath. I realise its probably really obvious but I am really new to this and getting myself confused! Any help on how to add an item then be able to go back to the products page (with the submit buttons for each product) and add a new item underneath the existing item in the shopping cart would be much appreciated! The code I have so far is: $submit = $_POST["submit"]; //If form is submitted, call the function and save all data into the array $_SESSION['form'] if($submit = "Buy"){setSessionVars();} function setSessionVars() { foreach($_POST as $fieldname => $fieldvalue) { $_SESSION['form'][$fieldname] = $fieldvalue; } echo "<table> <tr> <td>" .'<img src="images/'.$_SESSION['form']['item'].'.jpg"' . "<td/> <td>" . $_SESSION['form']['item'] . "</td> <td>" . '<input type="text(30)" name="value" value="1" /> <input type="submit" name="puchasednum" value="Update This One Item" />' . "</td> </tr> </table>"; }; ?> I have the session_start() function at the very top of every page. I have also attached the entire files for the two pages I talk about above. Thanks Graham Hi. I have the fokllowing xml response from an API and I am wanting to loop through the array(s) and get informaton for each of the rows below. For example I want to get the cells below for Consulting Income / 98e83040-fa3a-4185-9b9b-a49241e2bb76/150.32 then get each of the other items in the array. So the second iitem I want is Contract Income / 7d05a53d-613d-4eb2-a2fc-dcb6adb80b80 / 11748.96 and so on for each of the results returned
I am having a mental block about best way to get this information. Please advise best approach.
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Id>20f0b472-a63d-4c1f-a8de-d0fc4e860983</Id> <Status>OK</Status> <ProviderName>Xero API Previewer</ProviderName> <DateTimeUTC>2020-10-12T21:34:33.5492839Z</DateTimeUTC> <Reports> <Report> <ReportID>ProfitAndLoss</ReportID> <ReportName>Profit and Loss</ReportName> <ReportType>ProfitAndLoss</ReportType> <ReportTitles> <ReportTitle>Profit & Loss</ReportTitle> <ReportTitle>Demo Company (NZ)</ReportTitle> <ReportTitle>1 October 2020 to 31 October 2020</ReportTitle> </ReportTitles> <ReportDate>12 October 2020</ReportDate> <UpdatedDateUTC>2020-10-12T21:34:33.5492839Z</UpdatedDateUTC> <Rows> <Row> <RowType>Header</RowType> <Cells> <Cell /> <Cell> <Value>31 Oct 20</Value> </Cell> </Cells> </Row> <Row> <RowType>Section</RowType> <Title>Income</Title> <Rows> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Consulting Income</Value> <Attributes> <Attribute> <Value>98e83040-fa3a-4185-9b9b-a49241e2bb76</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>150.32</Value> <Attributes> <Attribute> <Value>98e83040-fa3a-4185-9b9b-a49241e2bb76</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Contract Income</Value> <Attributes> <Attribute> <Value>7d05a53d-613d-4eb2-a2fc-dcb6adb80b80</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>11748.96</Value> <Attributes> <Attribute> <Value>7d05a53d-613d-4eb2-a2fc-dcb6adb80b80</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Engineering Income</Value> <Attributes> <Attribute> <Value>225d8c93-251d-4a0b-9093-201acf69fe50</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>7217.29</Value> <Attributes> <Attribute> <Value>225d8c93-251d-4a0b-9093-201acf69fe50</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Equipment Income</Value> <Attributes> <Attribute> <Value>43f518a6-558f-402a-b22d-317bd64b1566</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>7377.17</Value> <Attributes> <Attribute> <Value>43f518a6-558f-402a-b22d-317bd64b1566</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Licence Income</Value> <Attributes> <Attribute> <Value>1ff30343-7bb2-4402-bb8f-a0813a7fb59e</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>3047.68</Value> <Attributes> <Attribute> <Value>1ff30343-7bb2-4402-bb8f-a0813a7fb59e</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Other Income</Value> <Attributes> <Attribute> <Value>b447935a-4b37-4f38-a841-fb3ae3b491e0</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>331.06</Value> <Attributes> <Attribute> <Value>b447935a-4b37-4f38-a841-fb3ae3b491e0</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>SummaryRow</RowType> <Cells> <Cell> <Value>Total Income</Value> </Cell> <Cell> <Value>29872.48</Value> </Cell> </Cells> </Row> </Rows> </Row> <Row> <RowType>Section</RowType> <Title>Less Cost of Sales</Title> <Rows> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Other Direct Costs</Value> <Attributes> <Attribute> <Value>9e77a829-37ea-4976-a9a8-d754e0e62f44</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>333.72</Value> <Attributes> <Attribute> <Value>9e77a829-37ea-4976-a9a8-d754e0e62f44</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>SummaryRow</RowType> <Cells> <Cell> <Value>Total Cost of Sales</Value> </Cell> <Cell> <Value>333.72</Value> </Cell> </Cells> </Row> </Rows> </Row> <Row> <RowType>Section</RowType> <Rows> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Gross Profit</Value> </Cell> <Cell> <Value>29538.76</Value> </Cell> </Cells> </Row> </Rows> </Row> <Row> <RowType>Section</RowType> <Title>Less Operating Expenses</Title> <Rows> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Accounting</Value> <Attributes> <Attribute> <Value>5e312344-4123-4cac-bb69-ad2d72d2280b</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>60.00</Value> <Attributes> <Attribute> <Value>5e312344-4123-4cac-bb69-ad2d72d2280b</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Advertising & Promotional</Value> <Attributes> <Attribute> <Value>61835d79-5a1c-4ab3-af82-af6930b38492</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>1112.21</Value> <Attributes> <Attribute> <Value>61835d79-5a1c-4ab3-af82-af6930b38492</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Bank Fees</Value> <Attributes> <Attribute> <Value>19828003-cea7-4920-b0fa-9223a2cdb0dc</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>28.75</Value> <Attributes> <Attribute> <Value>19828003-cea7-4920-b0fa-9223a2cdb0dc</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Cellphones</Value> <Attributes> <Attribute> <Value>ba533632-ac64-45c8-874e-b5a5aa6829f0</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>155.00</Value> <Attributes> <Attribute> <Value>ba533632-ac64-45c8-874e-b5a5aa6829f0</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Courier</Value> <Attributes> <Attribute> <Value>b70cadef-d8aa-46e6-b128-79e2c997fd2c</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>232.02</Value> <Attributes> <Attribute> <Value>b70cadef-d8aa-46e6-b128-79e2c997fd2c</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>EFTPOS Charges</Value> <Attributes> <Attribute> <Value>a164d99b-308e-4b2e-b3b4-a0c502214c77</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>40.00</Value> <Attributes> <Attribute> <Value>a164d99b-308e-4b2e-b3b4-a0c502214c77</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Engineering Resources</Value> <Attributes> <Attribute> <Value>53fdcc86-32ee-4fcb-b053-f449405bc7a5</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>1303.31</Value> <Attributes> <Attribute> <Value>53fdcc86-32ee-4fcb-b053-f449405bc7a5</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Entertainment - Partly Deductible</Value> <Attributes> <Attribute> <Value>d27cb87b-a3d2-4275-8948-95871fec4929</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>15.00</Value> <Attributes> <Attribute> <Value>d27cb87b-a3d2-4275-8948-95871fec4929</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Equipment Costs</Value> <Attributes> <Attribute> <Value>573a170b-6792-4cfa-b8ce-6f8fd27f5458</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>13746.93</Value> <Attributes> <Attribute> <Value>573a170b-6792-4cfa-b8ce-6f8fd27f5458</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>General Expenses</Value> <Attributes> <Attribute> <Value>11f618a8-f17e-4757-8b4a-6f24841bdb93</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>323.23</Value> <Attributes> <Attribute> <Value>11f618a8-f17e-4757-8b4a-6f24841bdb93</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Insurance</Value> <Attributes> <Attribute> <Value>92c673af-b2bc-45be-a888-a7e2c4bcc7f9</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>119.00</Value> <Attributes> <Attribute> <Value>92c673af-b2bc-45be-a888-a7e2c4bcc7f9</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>KiwiSaver Employer Contributions</Value> <Attributes> <Attribute> <Value>ab57eabe-5fa8-49d4-87dc-d5e7428323af</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>519.53</Value> <Attributes> <Attribute> <Value>ab57eabe-5fa8-49d4-87dc-d5e7428323af</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Licence Costs</Value> <Attributes> <Attribute> <Value>02dbaa55-95b9-464e-999c-c68e203cd67f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>2176.91</Value> <Attributes> <Attribute> <Value>02dbaa55-95b9-464e-999c-c68e203cd67f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Motor Vehicle Expenses</Value> <Attributes> <Attribute> <Value>b149780d-69bc-4f7c-a3ce-bd48f7a37de5</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>619.63</Value> <Attributes> <Attribute> <Value>b149780d-69bc-4f7c-a3ce-bd48f7a37de5</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Office Consumables & Postage</Value> <Attributes> <Attribute> <Value>b1769b51-e98e-432c-9670-d5be3054b717</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>56.00</Value> <Attributes> <Attribute> <Value>b1769b51-e98e-432c-9670-d5be3054b717</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Office Expenses</Value> <Attributes> <Attribute> <Value>935e0fbe-6749-41c8-a024-11321e44dfac</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>113.23</Value> <Attributes> <Attribute> <Value>935e0fbe-6749-41c8-a024-11321e44dfac</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Payment Processing</Value> <Attributes> <Attribute> <Value>8cd42505-ad73-46e2-932f-67952fdc4e99</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>174.51</Value> <Attributes> <Attribute> <Value>8cd42505-ad73-46e2-932f-67952fdc4e99</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Rent</Value> <Attributes> <Attribute> <Value>28113b99-6df2-4123-a2d0-5f54dcf8017b</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>1935.00</Value> <Attributes> <Attribute> <Value>28113b99-6df2-4123-a2d0-5f54dcf8017b</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Salaries & Wages</Value> <Attributes> <Attribute> <Value>be2e984a-17e1-4bf7-809c-b03a69325c90</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>17317.58</Value> <Attributes> <Attribute> <Value>be2e984a-17e1-4bf7-809c-b03a69325c90</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Security</Value> <Attributes> <Attribute> <Value>c814b08e-6558-4ac4-adce-ba76848a3a9f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>45.00</Value> <Attributes> <Attribute> <Value>c814b08e-6558-4ac4-adce-ba76848a3a9f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Subscriptions</Value> <Attributes> <Attribute> <Value>5ba8d64a-5b98-4bfd-a35e-7d0569e3446f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>102.96</Value> <Attributes> <Attribute> <Value>5ba8d64a-5b98-4bfd-a35e-7d0569e3446f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Telephone & Internet</Value> <Attributes> <Attribute> <Value>230e4cfc-f4c4-4c15-aa0d-bab02b954622</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>89.95</Value> <Attributes> <Attribute> <Value>230e4cfc-f4c4-4c15-aa0d-bab02b954622</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Travel & Accommodation - National</Value> <Attributes> <Attribute> <Value>36d33c5d-7dea-4911-9ed0-7fccc16f2b5f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>210.43</Value> <Attributes> <Attribute> <Value>36d33c5d-7dea-4911-9ed0-7fccc16f2b5f</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Utilities</Value> <Attributes> <Attribute> <Value>2e277847-022c-48f3-8467-0207230004d6</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> <Cell> <Value>348.14</Value> <Attributes> <Attribute> <Value>2e277847-022c-48f3-8467-0207230004d6</Value> <Id>account</Id> </Attribute> </Attributes> </Cell> </Cells> </Row> <Row> <RowType>SummaryRow</RowType> <Cells> <Cell> <Value>Total Operating Expenses</Value> </Cell> <Cell> <Value>40844.32</Value> </Cell> </Cells> </Row> </Rows> </Row> <Row> <RowType>Section</RowType> <Rows> <Row> <RowType>Row</RowType> <Cells> <Cell> <Value>Net Profit</Value> </Cell> <Cell> <Value>-11305.56</Value> </Cell> </Cells> </Row> </Rows> </Row> </Rows> </Report> </Reports> </Response> Edited October 13, 2020 by Barand code tags (XML) added |