Python Invoice Generator tutorial for beginners - Python GUI Automation project [resume project]

Поділитися
Вставка
  • Опубліковано 1 жов 2024

КОМЕНТАРІ • 68

  • @arielspalter7425
    @arielspalter7425 Рік тому +8

    This is absolutely amazing tutorial! I started binge watching your channel, you’ve uploaded so much great stuff.

  • @sauer7592
    @sauer7592 Рік тому +4

    Hi Hala can you show it with pyside6

  • @ahmedsaliem7041
    @ahmedsaliem7041 Місяць тому +1

    Thanks a lot. And about if I need to save each invoice as an archive and see the number of each invoice and make next and previous buttons to enable update for each invoice. How could I make this if possible. And thank you again.

    • @ahmedsaliem7041
      @ahmedsaliem7041 Місяць тому +1

      And save all data into sqlite3 thanks so much

  • @bentsionben-david2769
    @bentsionben-david2769 Рік тому +4

    Wow you are genious.. i searched this more than half a year 🙏🏻🙏🏻🙏🏻

  • @bentsionben-david2769
    @bentsionben-david2769 Рік тому +2

    Hi hala its realy amazing this video.. can you please add to it CRUD method like create, search, update, save, delete and print on hard copy? Pleasee, i tried for months and i failed, i think thousands of people want and need it.. please consider it.. thanks 🙏🏻🙏🏻🙏🏻

  • @samfritkin
    @samfritkin Рік тому +4

    Amazing, thanks a ton! Your videos are incredibly helpful.
    For anyone that's interested, I found a way to edit the tree:
    def delete_item():
    selected_item = tree.selection()[0]
    tree.delete(selected_item)
    Put this command in for a delete button you create and you should be able to select items from the tree and delete them without having to reset your entire invoice.

    • @mohdsarim4671
      @mohdsarim4671 10 місяців тому

      def Remove_items():
      for i in table.selection():
      id = i
      idx = table.index(id)
      table.delete(id)
      del invoice_list[idx]
      i made somethig like this to delete multiple items and also fron the invoice_list too

  • @enesk3474
    @enesk3474 Рік тому +2

    Hi Hala can you show it with pyside6 ?
    thanks

  • @blackglassmusical
    @blackglassmusical 27 днів тому

    why does an error occur saying like 'Package not found at .docx'

  • @gauravmankoo4743
    @gauravmankoo4743 Рік тому +2

    Hi, Hala I love ❤❤your videos. I have one request can you please make a video where you use a pdf file instead of a word document.
    thank you so much this really helped

  • @IbrahimAbuJamous-f4u
    @IbrahimAbuJamous-f4u 5 місяців тому

    Thank you so much for this helpful video, but I have a question as I have tried so much to show for example this word file in the frame in Tkinter, could you please help me with that?

  • @JorgeEscobarMX
    @JorgeEscobarMX Рік тому +1

    I actually didn't knew treeview was supposed to be used as a table render widget. I figure it was for showing up file system stuff like files and directories. Thanks for this tkinter tutorial

  • @TheRealWattsie
    @TheRealWattsie Рік тому +4

    Minor point, your Total should be the SubTotal plus the tax percentage of SubTotal...
    ie SubTotal $33.5, Tax 10% therefore: Total === $36.85 not $30.12...
    Unless you were thinking a discount, however a discount should be applied per item not just on total invoice.
    Cheers.

  • @pingmetal
    @pingmetal 2 місяці тому

    Thank you for the great tutorial. By the way, just note that when you used the module datetime and made it add time to the filename, the last digits were not just seconds. The first digits indicated the hours however using the 24-hour clock format, so as it was 8 PM on your PC, that became the number 20.

  • @solomonezra1253
    @solomonezra1253 Рік тому

    Hello Hala.. How are you?
    I have written same line of codes and it’s not updating the values in the.docx file.
    What might be the problem please and what can I do?
    Thank you

  • @thomashart5081
    @thomashart5081 8 місяців тому

    Great tutorial.
    Can you make a video on how to create also a record of the invoices as well as means to conclude which have been payed or not along with the saved invoice. Maybe a database SQLite and have the means to switch between displayed pages depending on which is wanted for viewing at the time.

  • @khushbukumari6000
    @khushbukumari6000 Рік тому +1

    Thank u so much mam 100% working

  • @familiezink9098
    @familiezink9098 4 місяці тому

    Very nice. Thank you so much for your videos. Greetings from Germany

  • @surendarsingh6228
    @surendarsingh6228 Рік тому

    where the additem function is add the previous list of invoice_item since we are not using the append ??? please let me know.

  • @kelechikk-xr7xh
    @kelechikk-xr7xh 4 місяці тому

    Hi this video tutorial is not bright

  • @MirzaAbubakar-l6b
    @MirzaAbubakar-l6b Рік тому

    I want to save the generated invoice in pdf form ,What should I do for that?

  • @MirzaAbubakar-l6b
    @MirzaAbubakar-l6b Рік тому

    I want to save the generated invoice in pdf form ,What should I do for that?

  • @Podalls
    @Podalls Місяць тому

    Can pyside6 use this?

  • @lstephen
    @lstephen Рік тому

    Do you think I can use python to pull data from Google docs once created and then put them into Google sheets of invoice template? and then have it covert to pdf and email to be send? Is this automation process possible?

  • @thedebapriyakar
    @thedebapriyakar 7 місяців тому

    I've been binging several of your tkinter videos since I found your channel this morning. Insanely good content, thank you SO MUCH for your efforts.

  • @DoctorLyrics97
    @DoctorLyrics97 Рік тому

    You explained it well. Can you do a video how to save data in to excel file to a format , I created a recipe saving app but I cannot figure out how to save the recipe in to a format. My current version it just saves in to pdf without template , as a chef I am very happy that I was able to created the gui app to that far 😂

  • @contraplano3157
    @contraplano3157 Рік тому

    I prefer PysimpleGui, for this one will be easy make the interface

  • @mohdsarim4671
    @mohdsarim4671 10 місяців тому

    thanks you so much your videos are amazing i only saw the part of docTemplate working and intro of the video and Tried to made this myself here is the version i made
    i added 2 extra features like removing the items , saving as a new file to a directory
    the code is this
    from customtkinter import *
    import tkinter.ttk as ttk
    import tkinter as tk
    from docxtpl import DocxTemplate
    import tkinter.filedialog as fd
    import tkinter.messagebox as tmsg
    import os
    root = CTk()
    set_appearance_mode('dark')
    root.title("Invoice Generator")
    root.geometry("800x580")
    # creating widgets
    cfont = CTkFont(family="Sans Serif",size=20,weight="bold",)
    head = CTkLabel(root,text="Invoice Generator",font=cfont)
    head.place(relx = 0.5,rely =0,anchor = "n")
    EntriesFrame = CTkFrame(root)
    EntriesFrame.place(relx = 0,rely = 0.07,relwidth = 1)
    l1 = CTkLabel(EntriesFrame,text="First Name")
    l2 = CTkLabel(EntriesFrame,text="Last Name")
    l3 = CTkLabel(EntriesFrame,text="Phone Number")
    l4 = CTkLabel(EntriesFrame,text="Qty")
    l5 = CTkLabel(EntriesFrame,text="Description ")
    l6 = CTkLabel(EntriesFrame,text="Unit Price")
    e1 = CTkEntry(EntriesFrame)
    e2 = CTkEntry(EntriesFrame)
    e3 = CTkEntry(EntriesFrame)
    e5 = CTkEntry(EntriesFrame)
    style = ttk.Style()
    print(style.theme_names())
    style.theme_use("default")
    style.configure('C.TSpinbox',
    background ='gray14',
    arrowcolor ="gray84",
    foreground="gray84",
    fieldbackground = "#343638",
    bordercolor ="yellow",
    padding = (5,5),
    arrowsize = 12,
    selectbackground ="#1f538d",
    insertwidth = 10
    )
    qtyvar = IntVar(value=0)
    spb4 = ttk.Spinbox(EntriesFrame,from_=0,to=100,textvariable=qtyvar,style='C.TSpinbox')
    unitpricevar = DoubleVar(value=0.00)
    spb6= ttk.Spinbox(EntriesFrame,from_=0.00,to=5000.00,increment=0.5,textvariable=unitpricevar,style='C.TSpinbox')
    invoice_list = []
    i =0
    # function to get the final cost of each item , qty*unitproce
    def Add_lnTotal(x):
    linetotal = x[0]*x[2]
    x.insert(3,linetotal)
    return x
    # to Sum the list Elements
    def sumlist(x):
    sum = 0
    for i in x:
    sum+=i
    return sum
    def calc_subtotal():
    global subtotal
    linetotal = [x[3] for x in invoice_list]
    subtotal = sum(linetotal)
    return subtotal
    # functio to Calculate Tax from String
    def total_with_tax(t,s):
    tax_dig = int(t.split('%')[0][:1])
    tax = float(f"0.{tax_dig}")
    return s*tax+s
    def Calc_Total():
    global total
    total = total_with_tax("10%",calc_subtotal())
    def Add_items():
    global fname,lname,phone,Desc,i
    global Qty,UnitPrice,items,invoice_list,linetotal,subtotal,total
    fname = e1.get()
    lname = e2.get()
    phone = e3.get()
    Desc = e5.get()
    Qty = qtyvar.get()
    UnitPrice = unitpricevar.get()


    # MAKING A 2D INVOICE LIST
    items = [Qty,Desc,UnitPrice]
    invoice_list.append(Add_lnTotal(items))

    # counting Subtotal &
    # Caluting Total after including Tax
    # with one function call
    Calc_Total()
    tempdata = Add_lnTotal(items)
    tempdata.pop()
    data=tuple(tempdata)
    table.insert(parent = '',index=i,values=data)
    i+=1
    print(data)
    print(invoice_list)
    # print(f"First Name:{fname}, Last Name : {lname},
    "
    # f"Phone Number :{phone}, Description :{Desc}"
    # f"Qty : {Qty}, Unit Price : {UnitPrice}"
    # )
    def Remove_items():
    for i in table.selection():
    id = i
    idx = table.index(id)
    table.delete(id)
    del invoice_list[idx]
    Calc_Total()
    print(subtotal)
    print(invoice_list)
    addbtn = CTkButton(EntriesFrame,text="Add Item",command=Add_items)
    Removebtn = CTkButton(EntriesFrame,text="Remove Item",command=Remove_items)
    # making Grids
    EntriesFrame.columnconfigure((0,1,2),weight=1)
    EntriesFrame.rowconfigure((0,1,2,3,4),weight=1)
    # placing widgets
    l1.grid(row = 0,column = 0)
    e1.grid(row = 1,column = 0)
    l2.grid(row = 0,column = 1)
    e2.grid(row = 1,column = 1)
    l3.grid(row = 0,column = 2)
    e3.grid(row = 1,column = 2)
    l4.grid(row = 2,column = 0)
    spb4.grid(row =3 ,column = 0)
    l5.grid(row = 2,column = 1)
    e5.grid(row = 3,column = 1)
    l6.grid(row = 2,column = 2)
    spb6.grid(row = 3,column = 2)
    addbtn.grid(row= 4 ,column = 1,sticky = "news",padx = 60,pady = 20)
    Removebtn.grid(row= 4 ,column = 2,sticky = "news",padx = 60,pady = 20)
    infoFrame = CTkFrame(root,fg_color="gray14",corner_radius=0)
    style.configure("table.Treeview",fieldbackground = "gray17",foregorund = "white")
    style.configure("table.Treeview.Heading")
    table = ttk.Treeview(infoFrame,style = 'table.Treeview',columns=(0,1,2,4),show='headings')
    table.heading(0,text="QTY")
    table.heading(1,text="Description")
    table.heading(2,text="Unit Price")
    table.heading(3,text="Total")
    table.place(relx = 0.072,rely = 0.04,relwidth=0.86,relheight = 0.96)
    infoFrame.place(relx = 0 ,rely = 0.38,relwidth = 1,relheight=0.46)
    global generate_invoice
    def generate_invoice():

    def write_data(x):
    doc = DocxTemplate("invoice_template.docx")
    doc.render({
    "name":f"{fname}{lname}",
    "phone" : phone,
    "invoice_list":invoice_list,
    "subtotal":subtotal,
    "salestax":"10%",
    "total":total
    })
    doc.save(x)


    flag = tmsg.askyesno("Create File","Want To Create a New File ?")
    if flag :
    fdir = fd.askdirectory(
    title="Save file To"
    )
    inpd =CTkInputDialog(title="Enter Name",text="Enter The the name of the File")
    filename = f"{inpd.get_input()}"
    file_path = f"{fdir}/{filename}.docx"
    write_data(file_path)
    tmsg.showinfo("Success",f"Generated At {file_path}")
    else:
    file_path = "Records.docx"
    write_data(file_path)
    tmsg.showinfo("Success","Your Invoice hava Been Generated Succesfully in Default Directory")


    frameBtn =CTkFrame(root,fg_color="gray18")
    btn1 = CTkButton(frameBtn,text="Generate Invoice",command=generate_invoice)
    btn1.pack(fill=X,pady = 5,padx = 60)
    btn2 = CTkButton(frameBtn,text="New Invoice")
    btn2.pack(fill=X,padx = 60,pady =5)
    frameBtn.place(relx = 0,rely = 0.853,relwidth = 1)
    root.mainloop()

  • @matthewdamolaojelere6553
    @matthewdamolaojelere6553 8 місяців тому

    Every bit of your tutorial is very understable and good, you are good in explaning code

  • @Noopdoom
    @Noopdoom Рік тому

    Can you make one more video this. How to create exe file

  • @leekumkitv3826
    @leekumkitv3826 Рік тому

    BROTHER, YOU ARE THE BEST!!! You oooh really helped me!! THANK YOU VERY MUCH!

  • @sandrogirolamo
    @sandrogirolamo Рік тому

    Very good Hala! Your explanation is structured, clear, you have a wonderful voice, your speak is clear like water, have a good pace to understand every word. This reports example is very good. Have you made some report example using sqlite data?

  • @kangdesain3922
    @kangdesain3922 10 місяців тому

    hi great tutorial, how to make all of this into exe format?

  • @رادیندولتی
    @رادیندولتی Рік тому

    This channel will reach 1 million subscribed, I promise 💙

  • @IbrahimDar-nu5tz
    @IbrahimDar-nu5tz Рік тому

    The stuff which i was looking for.......thanks for sharing!

  • @yahia_nali
    @yahia_nali 10 місяців тому

    Macha Allah, you are the best Hala in the world! I mean it.

  • @logunscott
    @logunscott Рік тому

    Amazing tutorail Thank you. please is there a way to edit or delete an item in the list?

  • @BelalAhamdNasery
    @BelalAhamdNasery Рік тому

    Hi Hala can make Django videos 🙏🏻

  • @alananalyst7795
    @alananalyst7795 Рік тому

    Hey Hala, I just wanted to thank you for this kind of videos, I am really enjoying them

  • @ntutfitness
    @ntutfitness Рік тому

    Ilove the all series of template projects. Thanks

  • @ShadowMindInsights-qk4vc
    @ShadowMindInsights-qk4vc 8 місяців тому

    Thank you God bless you mam

  • @dilshanchrishantha6548
    @dilshanchrishantha6548 Рік тому

    excellent tutorial, well explained, keep moving !!!!

  • @abuloly2690
    @abuloly2690 Рік тому

    Nice work girl , amazing project 🎉

  • @LEON-zo7ce
    @LEON-zo7ce Рік тому

    what a life saver ....... ......thank you🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @Harambe_
    @Harambe_ 10 місяців тому

    Very helpful, thank you!

  • @contraplano3157
    @contraplano3157 Рік тому

    why they do not use the open document format?

  • @nassimelmasri6515
    @nassimelmasri6515 Рік тому

    Super Tutorial Thank you Hala

  • @rzvn111
    @rzvn111 11 місяців тому

    You are great! Thanks!

  • @KeKuHauPiOx
    @KeKuHauPiOx Рік тому

    Awesome tutorial! Is there a way to put a business logo on this?

    • @vdeoracle
      @vdeoracle Рік тому

      Yes. You can customize the docx template to suit your need.

  • @fabriciocarranza7044
    @fabriciocarranza7044 Рік тому

    Great video. I am Learning a lot

  • @mukeshkumars9887
    @mukeshkumars9887 2 роки тому

    HI HALA THANK YOU FOR YOUR EFFECT ON THIS VIDEO

  • @migue29movi64
    @migue29movi64 11 місяців тому

    You're the best Nala!!!

  • @bigrevkev55
    @bigrevkev55 9 місяців тому

    Thank you again!!!

  • @anassportal
    @anassportal 9 місяців тому

    Awesome tutorial

  • @feras5834
    @feras5834 Рік тому

    Great video.. thank you 🙂

  • @its_code
    @its_code 2 роки тому

    😍💗😍💗😍💗😍🤩🤩🤩🤩

  • @samokoth1014
    @samokoth1014 5 місяців тому

    Great

  • @fabriciocarranza7044
    @fabriciocarranza7044 Рік тому

    Thank you.

  • @digitalmachine0101
    @digitalmachine0101 6 місяців тому

    Good information

  • @kksfervajali6602
    @kksfervajali6602 Рік тому

    So Helpful

  • @lynn7140
    @lynn7140 2 роки тому

    Thanks.❤

  • @kapibara2440
    @kapibara2440 6 місяців тому

    Brilliant tutorial ❤❤❤thank you.

  • @destinbrav4903
    @destinbrav4903 Рік тому

    please guys i'm getting an error at 8minute of the video please help me !!! here is the error :
    raise PackageNotFoundError(
    docx.opc.exceptions.PackageNotFoundError: Package not found at 'template.docx'
    that is the last line of the error

    • @iioru1829
      @iioru1829 10 місяців тому

      did you have the Word template downloaded in your programs files?

    • @familiezink9098
      @familiezink9098 4 місяці тому

      pip install docxtpl