从列表视图中的条目生成简短的多个报告(VB.NET) [英] Generate short multiple reports from entries in a listview (VB.NET)

查看:92
本文介绍了从列表视图中的条目生成简短的多个报告(VB.NET)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我的名字很好,我需要一个任务的帮助,我在vb.net上的项目工作。我在表单上有一个列表视图,列表视图有4个固定列和尽可能多的行,基于点击几个按钮的用户条目。如果用户点击服装按钮,则会插入一行,如下所示:



hello there, my name is ade and i need help on a task, am working on project in vb.net. i have a listview on a form, the listview has 4 fixed columns and as many rows as possible based on user entries at the click several buttons. if a user clicks a garment button a row is inserted and it looks like this:

Desc,        Amount      Quantity    No. Piece
-----------------------------------------------
2pc suit      500           2           2



(插入服装及其成本,带来的服装数量以及制作服装类型的件数)



当他点击一个颜色按钮时,现在插入了另一行,使列表视图看起来像这样:




(inserting a garment with its cost, the quantity of garments brought and how many pieces makes that garment type)

when he clicks a color button another row is inserted now making the list view look like this:

Desc,            Amount          Quantity        No. Pieces
-----------------------------------------------------------
2pc suit          500               2               2
black





当他点击一个布料按钮时,现在插入另一行,使列表视图看起来像这样:





when he clicks a fabric button another row is inserted now making the list view look like this:

Desc,        Amount      Quantity    No. Pieces
------------------------------------------------
2pc suit      500           2           2
black
wool





上面提到的任务我可以实现,但现在点击一个按钮我需要生成一张票或发票以及一些标签(简短的描述/细节)报告。生成这些标签是问题,从上面你可以看到已经输入(插入)两件2件套装和2件组成2件套装(2件套装)这意味着4个标签(即2件次数量2)。 br />


这些标签将带有物品名称,颜色,面料,数量和总数量(将其列为1of4,2of4,3of4和4of4)。



这样的事情:



The above mentioned tasks i can achieve, but now at the click of a button i need to generate a ticket or invoice along with some tags(short descriptive/details) report . Generating these tag is the issue, from the above you can see that two 2piece suit has been entered (inserted) and 2 items make up a 2pc suit( 2 piece suit) this implies 4 tags (that is 2piece times quantity 2).

these tags will carry name of item, color, fabric, amount and total quantity (listing it as 1of4,2of4,3of4 and 4of4).

something like this:

===================================================
= (1/4)  Due date 23/05/2017 User:2               =
= customer name: Tom Jones Contact No: 08023345677=
= 2pc Suit 500/blue/cotton                        =
===================================================



当你现在有这样的东西时会变得更复杂,




It gets more complicated when you now have something like this,

Desc,        Amount      Quantity    No. Pieces
-------------------------------------------------
2pc suit      500           2           2
black
wool
-------------------------------------------------
Shirt        200            1           1
blue
cotton
-------------------------------------------------
Shirt        200            1           1
white
cotton
-------------------------------------------------
Shirt        200            1           1
pink
cotton
-------------------------------------------------



请欣赏任何帮助,因为卡住了,不知道从哪里开始。关于生成这些标签



热情的问候



我尝试了什么:



i在这个问题上还没有尝试任何东西

请欣赏任何帮助,因为卡住了,不知道从哪里开始。生成这些标签


please will appreciate any assistance , as am stuck and don't know where to start. on generating these tags

warm regards

What I have tried:

i have not tried anything yet on this very issue
please will appreciate any assistance , as am stuck and don't know where to start. on generating these tags

推荐答案

嗯...你将重点放在 ListView 控件而不是数据。对不起,这是错误的做法。



为了免除麻烦,我建议将发票视为一组对象:

Well... You're keeping a focus on a ListView control instead of data. I'm sorry, but this is wrong approach.

To spare you trouble i'd suggest to think about invoice as a set of objects:
invoice
    (
    invoice no.,
    date of sale,
    item on invoice
        (
          selled object /a garment in your case/,
          amount,
          price,
          etc.
        )
    ),
seller (seller no., name, etc.),
buyer (buyer no., name, etc.)





每个对象应表示为< a href =https://msdn.microsoft.com/en-us/library/ms973814.aspx>一个类 [ ^ ],其中包含多个属性。例如,客户可以定义为:





Every single object should be represented as a Class[^], which contains several properties. For example, Customer may be defined as:

Public Class Customer
	Private sName As String = String.Empty
	Private sContactNo As String = String.Empty
	
	Public Sub New()
		'default - empty constructor
	End Sub

	Public Sub New(ByVal _Name As String, ByVal _ContactNo As String)
		sName = _Name
		sContactNo = _ContactNo
	End Sub
	
	Public Property Name As String
		Get
			Return sName
		End Get
		Set (value As String)
			sName = value
		End Set
	End Property

	Public Property ContactNo As String
		Get
			Return sContactNo
		End Get
		Set (value As String)
			sContactNo = value
		End Set
	End Property
End Class





所以,创建客户对象:



So, to create Customer object:

Dim cust As Customer = New Customer("Maciej Los", "0123654789")





我不想提供完整的代码,因为这是你的工作。结论是:你应该从基础开始:

Visual Basic中的对象和类Microsoft Docs [ ^ ]

定义类(Visual Basic)| Microsoft Docs [ ^ ]

深思熟虑:创建自己的收藏类 [ ^ ]



祝你好运!



I wan't to provide complete code, because it's your job. Conclusion is: you should start from basics:
Objects and classes in Visual Basic | Microsoft Docs[^]
Defining Classes (Visual Basic) | Microsoft Docs[^]
Walkthrough: Creating Your Own Collection Class[^]

Good luck!


这篇关于从列表视图中的条目生成简短的多个报告(VB.NET)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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