PHP的JavaScript报告显示行细节和总结 [英] php javascript report to show line details and summary

查看:158
本文介绍了PHP的JavaScript报告显示行细节和总结的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道该从哪里开始,因此希望社区能够指出我的正确方向。



我需要为所有订单创建报告/视图在我们的数据库中。



我可以很容易地编写sql来获取订单项详细信息(产品,数量,价格)。我还可以编写sql以返回摘要详细信息(客户,地址,总价)。

我可以使用PHP循环显示订单项或汇总项每个订单,但我不知道如何使用一个循环,显示两个?



例如,下面显示我的订单与总结:



我想展示我的页面,下面的命令可以展开它们:


那么当我的sql数据数组没有摘要信息和行级别信息时,我该如何做到这一点?这可以结合成一个单一的数组,如果是的话,我该如何在循环中调用它。



如果我必须使用带有jquery的DIV来折叠和扩展div,我可以这样做,但不知道如何在订单详细信息之上显示订单概述?



任何建议,如果不是代码示例,指针是受欢迎的。有没有这样的图书馆?



感谢一如既往。

解决方案

您有很多选择



1.获取主要订单数组,然后相应地循环并触发查询以获取循环内的详细信息以获取相应订单ID的订单详细信息在循环中并在关联数组中分配该细节,最后您将获得一个关联数组,其中包含订单和相应的订单明细。



2.您可以完成以上所有操作只在想要显示列表的位置处进行处理。



3.您想隐藏/显示订单详情,您可以在每个订单行下方创建div,并填写在默认情况下,div的样式的细节将显示:none只是在点击时为了显示细节而阻止它。



4.您可以添加一个AJAX在点击订单时调用订单明细并替换订单明细div的html并进行样式显示:block



5.您也可以在鼠标悬停上执行上述过程,以在鼠标指针的工具提示上显示浮动div,并使用选项预先加载隐藏详细信息或使用ajax加载详细信息来显示详细信息。



希望您可以针对您的问题使用任何一种逻辑


not sure where to start on this one so looking to the community to point me in the correct direction.

I need to create a report/view for ALL orders in our database.

I can write the sql easily enough to fetch the line item details (Product, QTY,Price). I can also write the sql to return the summary details(Customer, Address, total Price)

I can use a PHP loop to display the line item OR the summary items for each order but I dont know how to use one loop that shows both?

so example, the below shows my orders with summary:

I want to show my page with orders collapsed like below with the ability to expand them:

So how do I do this when my sql data array does not have the summary info and line level info? can this be combined into a single array and if so how do I call it in a loop.

if I had to use DIVs with jquery to collapse and expand the divs, I can do that but no idea how to show the orders ummary above the order details?

any advice, pointer are welcome if not a code sample. is there a library for this?

Thanks as always.

解决方案

You have many options

1.Get the main orders array and then loop accordingly and fire query to get details inside the loop to get the order details for the respective order id in the loop and assign that detail in an associative array and finally you will get a associate array with the orders and respective order detail.

2.You can do all the above process at the view only where you want to show the listing.

3.You want to hide/show the order details you can create divs just below each order row and fill the details of order in it by default the div style will be display:none just make it block when clicked on order to show details.

4.You can add an AJAX call to bring the order detail when clicked on the order and replace the html of the order detail div and make its style display:block

5.You can do the above process on the mouseover also to show a floating div on the tooltip of the mouse pointer and show details with both option preloaded hidden details or load details with ajax

Hope You can use any of the one logic for your question

这篇关于PHP的JavaScript报告显示行细节和总结的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆