Author Topic: Project Announcement  (Read 724 times)

0 Members and 1 Guest are viewing this topic.

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Project Announcement
« on: September 24, 2021, 11:49:09 pm »
I would like to propose to the Sage 100 customer base an alternative to signing up for the subscription plan after you already bought the software. I personally think it's wrong to cripple and penalize customers that wish to hold Sage to the original contract when they purchased the software. I'm an open source advocate and maintain an open source scripting language. (ScriptBasic) I host a number of BASIC related forums as well.

I'm not a fan of Node.js, Java or Python. I do like PHP for web applications. Most blogs, forums and CMS packages are written in PHP using MySQL as the DB. I have been toying with the idea of using Front Accounting as a migration path for Sage 100 customers that want off or not get on the subscription bus.

I'm in the process of creating a data migration utility for FA from Sage 100. If you would like to participate with this effort than please join the forum which will give you access to a section of the forum reserved for this project. I like the framework FA developed and the active community involvement with the project. I would like to fork FA and enhance it to meet the functional standards 100 established.

Sales And Accounts Receivables
  • Open Customer Accounts and Customer Branches
  • Make Sales Areas, Sales Types, Sales Groups, Salesman Groups
  • Make Sales Groups for grouping Customer Branches
  • Prepare Sales Quotations (with inquiry and creating of Sales Orders)
  • Prepare Sales Orders and Goods Delivery Notes
  • Prepare Customer Invoices and Credit Notes
  • Make Batch Invoicing for more than one delivery order.
  • All of the Sales documents are completely editable and printable
  • Point of sales definitions for better handling of cash sales
  • Customer Payments and Allocations
  • Company logos can be attached to sales documents
  • Dimensions can be selected for Sales Delivery and Invoices
  • Shipping Costs and Legal Text can be added to Invoices
Purchases and Accounts Payable
  • Open Supplier accounts
  • Make Purchase Orders, Goods Received Notes and Payment Terms
  • Clearing of Goods Received Notes
  • Entry of Supplier price lists & related conversion factor into purchase prices
  • Prepare Debit Notes and record Credit Notes from Suppliers
  • Supplier Payments and Allocations
  • Company logos can be attached on documents
  • Dimensions can be selected for Purchase Orders and Purchase Invoices
  • Option of attaching scanned documents with transactions
Inventory and Stocks
  • Record Stock Items
  • Define Item Categories and Item Locations
  • Record location transfers and other adjustments
  • Set re-order levels for Inventory Items
  • Automatic calculation of average material cost (per unit)
  • Application of standard and overhead costs, into material prices
  • Quantity of Items can be measured into standard units
  • Foreign codes registration for barcode scanner entry
Manufacturing
  • Prepare bills of materials, Work Center inquiries and Work Order entries
  • Feasibility of adding advanced production and simple assembling features
Fixed Assets
  • Fixed Assets Purchase
  • Fixed Assets Location Transfers
  • Fixed Assets Disposal
  • Fixed Assets Sales
  • Fixed Assets Movements
  • Fixed Assets Inquiry
  • Process Depreciation
  • Locations, Categories and Classes
Dimensions
  • Two level of Dimensions are possible. You setup this in Company Setup.
  • Two levels could be: Departments, Cost Centers.
  • One level could be Cost Center or Project.
Cash and Bank
  • Open Bank and Petty Cash Accounts
  • Record payments, deposit and withdrawals in related accounts
  • Various currencies can be added and foreign currency translation is also done
  • Record bank inquiries and reports
  • Prepare bank accounts reconciliation
  • Transactions can be made void and reprinted
General Ledger
  • Open general ledger accounts, account classes and groups
  • Record journal entries and budget entries
  • Generate ledger accounts detailed inquiries with drill down reports
  • Make journal inquiries with an option to view journal entries
  • Closes the fiscal year and brings forward retained earnings
  • Record depreciation entries on period based
  • Make journal entries with corresponding entry in supplier / customer account
  • Filter General Ledger reports by dimensions
  • Quick entries (preset GL transactions) in bank deposit/payment, journal entry and supplier invoice/credit
Reports
  • Print, Email and Convert into PDF; all the reports
  • Export the reports in MS Excel/Open Office Calc format
  • Generate reports on periodic and financial years basis
  • Email documents directly to customers
  • Make graphical analysis (Horizontal/Vertical Bars, Dot Lines, Pies and Donuts)
  • Tag and save report selections
Access Levels and Adaptations
  • Different companies can be set-up simultaneously
  • Separate financial years can be created and closed against entries
  • Multi user access with different privileges
  • Make backups and restore for companies
  • Date Picker with week numbers for all date fields
  • Simple Audit Trails
  • Extensions for customizing menu tabs and applications
Advanced Features
  • Multi-Currency Support
  • Historical Currency Rates
  • Multi-Currency Bank Accounts, Customers And Suppliers
  • GST/VAT can be selected on Customer, Supplier and Item basis
  • Advanced GST/VAT report for details and outputs/inputs
Language Support
  • Full support for localization by the GNU's gettext package
  • Multi language support with right to left support in Arabic language
  • Different chart of accounts can be installed and activated
  • Jalali and Islamic calendars are supported
Other Details
  • Every document can be emailed and printed simultaneously
  • PDF can be formatted for every document
  • Projects, Cost Centers, Departments can be added, using Dimensions

I have installed Front Accounting (2.4.10) on the OpenSage.org site for this project. It runs really well. Members of the forum will have access to this development fork to work with. I'm also going to create a repository for the project in the https://basic-sandbox.us Gitlab-ce I host for code contributions.

Front Accounting Home Page



I have attached a few screen shots from the installed copy here on the Open Sage site.

There is a DEMO install on the Front Accounting site you can evaluate the software to see if it would fit your needs.   
« Last Edit: September 28, 2021, 12:25:04 am by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #1 on: September 28, 2021, 12:31:46 am »
I have created a repository for the Open Sage ERP project. Those who join the forum and wish to participate in this project will be giving the ability to submit enhancements. Hosting and taking on a project manager role is my initial contribution to the project. I hope others will join in and contribute their talents to the project.

OS-ERP - Open Sage ERP Repository
« Last Edit: September 28, 2021, 12:37:10 am by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #2 on: September 29, 2021, 09:52:20 pm »
Here is my list of advantages using OS ERP.
  • FREE
  • Open Source
  • Brower based using PHP & MySQL
  • Unlimited hosting options or use local
  • Mature software with active community involvement
  • Multi-currency with global use
  • Object design and easily customizable
  • Paperless design focus with e-mail integration
  • Interface with the company web site directly, no middleware need

My favorite open source post of the day.

Quote
I think the developers are looking at experienced programmers like you to suggest a solution, This is what open source is all about. A community collaboration. So if you think you have a solution then suggest it. If they see it feasible they will include it.
« Last Edit: September 29, 2021, 10:45:24 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #3 on: September 30, 2021, 12:07:08 am »
I was happy to discover that a Payroll / HR extension is available for FA.

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #4 on: October 01, 2021, 10:40:43 pm »
I view this project as an insurance policy if Sage continues in their free fall. I have offered to facilitate and act as a project manager as my initial contribution to the project. I'm not doing this alone. If this is going to be successful then Sage 100 customers, partners and developers need to participate and make this a community effort. As of this point no one has registered on the forum and shown interest in the project. I hope that changes soon.

I feel the first task on the list is a Sage 100 migration utility. This will allow users to quickly evaluate the package without much effort using their own data.

If you need help setting up Open Sage ERP (Front Accounting) on a web hosting site let me know. My suggestion is to get a copy running and see if it will fill your needs as is. I would like to hear what you like or dislike about the package and what you feel may be missing.

Thanks in advance for your participation.

« Last Edit: October 02, 2021, 10:12:56 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #5 on: October 03, 2021, 12:52:32 pm »
I have updated the OS-ERP repository with the updates and bug fixes since the 2.4.10 release. If you are going to install Open Sage ERP (Front Accounting) you should download the code from the repository rather than the Front Accounting site.

https://basic-sandbox.us/opensage/os-erp

The project needs help in the following areas.
  • Help building a Open Sage ERP wiki on the repository site. This wiki uses markdown which is easy to use and understand. There is Gitlab help on markdown if you are unfamiliar with this documentation standard.
  • Accounting Pros that can document building chart of accounts in Open Sage ERP.
  • I could use a hand with the Sage 100 to FA data migration utility.
  • Folks willing to join the forum to help out with the project. Once again, this is NOT my project and a community effort to foster a Sage 100 compatible web based accounting solution.
 


« Last Edit: October 03, 2021, 01:03:02 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #6 on: October 04, 2021, 11:02:41 pm »
I was able to install OS-ERP (Front Accounting) local on one of my Windows 10 Pro laptops. The first step is to install XAMPP 64 bit which installs Apache, MySQL and phpMyAdmin for database maintenance. I than download the OS-ERP repository into my C:\xampp\htdocs\fademo directory. I created a database with phpmyadmin prior to running the OS-ERP install by pointing your browser to localhost/fademo URL.

Hint:  The default user for MySQL is root with no password.
« Last Edit: October 04, 2021, 11:46:29 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #7 on: October 09, 2021, 03:44:22 pm »
I downloaded the MySQL sample database which I plan to use to build the OS-ERP demo database. It provides the core tables to get something going.

This is the classicmodels DB in SQL format I found on Github if you want to get an idea what the data looks like.

https://github.com/hhorak/mysql-sample-db/blob/master/mysqlsampledatabase.sql

REST API

I noticed an extension module for FA that provides a REST API. The following link will allow you to submit requests to a test server.

https://andresamayadiaz.github.io/FrontAccountingSimpleAPI/


 
« Last Edit: October 10, 2021, 02:09:54 am by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #8 on: October 10, 2021, 05:28:46 pm »
I had the opportunity to work with Acumatica and peek at their framework. It's a Microsoft monster and runs like a turtle. The package consists of C# generated .Net class DLLs which feeds .ASP for the web layer. Add IIS as the web server and it's another sad story of a company buying into Microsoft with no regard to multiple layers, bloatware or performance. Front Accounting is lightning fast, runs on everything using industry standard tools. (PHP / MySQL)

If resellers wanted to package and sell OS-ERP there is nothing stopping them from doing so. Creating extension is another way to monetize the direction. I really don't see Sage doing any more than maintaining Sage 100 with minor enhancement just to keep interest. Keep in mind the Business Basic programmer resource is getting thin with none of the younger programmers even considering looking at the language.

FA is a solid ERP that would be a good fit for most current 100 users. It would be a shame to let this opportunity pass and continue being forced fed the garbage being offered commercially. The hosting rip off is just salt on the wound.

If Sage partners / developers would commit to funding me to spend full time on the project I feel we could have a Sage 100 compatible solution all of us would benefit from. At this point I can only dedicate my spare time towards the project as like everyone one else I have bills to pay.
 
Fun Fact

OpenSAGE is a free, open source re-implementation of SAGE, the 3D .real-time strategy engine used in Command & Conquer Generals and other RTS titles from EA Pacific.

https://opensage.github.io/

Your cost for Sage Intacct will depend on the size of your accounting team and the modules you choose to implement. On average, our customers spend $15,000 to $35,000 on their annual subscription. Implementation typically costs one to one and a half times the amount of your annual subscription.

Please help me understand why a community driven open source ERP doesn't make sense.
« Last Edit: October 14, 2021, 02:07:15 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #9 on: October 15, 2021, 12:39:31 am »
I feel the only way that this project is going to move forward on a consistent basis is if Sage partners sponsor the project. This has the potential of giving reseller status back to the business with an open source brand of their own. A community version would be available supported by the community on a peer basis. I will support sponsors bringing Open Sage ERP (or your branding) into your product line offering. This will include helping your team get up to speed with the framework and doing enhancements.

My open source contribution to the project will be facilitating the effort and promote a community involvement,

If you would like to sponsor this project by committing to a week of my time and become a provider, please send me an e-mail to support@opensage.org to chat more about the opportunity.

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #10 on: October 15, 2021, 08:11:57 pm »
My suggestion is to install Front Accounting as a sub-directory off your current website or use XAMPP to run it on Windows and evaluate the software for yourself. If you feel like I do that it's a good foundation for the Open Sage ERP 100 work-a-like project, join the forum and let's hear your suggestions and opinions.


John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #11 on: October 16, 2021, 10:00:15 pm »
In this post I will try to clarify the direction of this project and its goals. Sage has been on mission to transform the 100 program into a cloud like product offering. The reseller program was eliminated and those selling the product were made partners / agents with a new commitment of revenue sharing from subscriptions as long as you meet quota and don't upset their customer. The subscription program direction is to eliminate outside sales and development resources and bring those services in-house. Sage punishes their loyal customers with crippled software and threats of no support if you don't get on board with their subscription program and buy the software again. My crystal ball tells me Sage will end of life their desktop offerings starting with 500 then 300 and finally 100 with a push to move those customers to Intacct or X3. I don't see their new Business Cloud (old Sage One) able to compete with QBO, ZERO or the handful of other like offerings. A reseller I know said it best. Working with Sage is like milking a dead cow.

Where does that leave Sage 100 customers and Partners? It's time to think about a disaster recovery plan and not die off with Sage's missteps and poor direction choices. The Open Sage ERP project is attempting to provide that safety net. This direction eliminates direct software costs by using open source software. Commercial accounting software is one the most expensive software investments being offered today with a glut of companies cashing in on the greed trend to keep this artificial cost prospering. Sage is notorious for monetizing every aspect of their business may it be documentation, developer resources and going to their sales meetings. Everything has a price tag.   

The Open Sage ERP project goals are to give Sage 100 partners their customers back and provide the direct service they once offered.  Sponsors will become the reseller network supporting their customers with software they can afford to use. Budgets can be used for implementation, training and support. I would like to dedicate my efforts to this project working with sponsors building a network of providers working together to archive a compatible 100 product that is web browser based. (self hosting or on premise) Sponsors will have their own sub-domain of OpenSage.org for demos and branding their direction with the product which I will host at no cost to the sponsor.

If this direction sounds like a viable plan, download the current version of Open Sage ERP (currently a mirror of FA) from the https://basic-sandbox.us/opensage/os-erp repository which I'm keeping current and evaluate for yourself if this project makes sense as the future of Sage 100.



   
« Last Edit: October 17, 2021, 09:35:43 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #12 on: October 22, 2021, 11:52:25 pm »
There doesn't seem to be much interest in the project so far. I'm wondering if PHP is holding back BASIC developers from contributing. Good news, I have the ScriptBasic application server running as a proxy on Open Sage. This will allow extending the package with ScriptBasic rather than PHP. SciptBasic can use the HTML, CSS and JavaScript used in the core PHP code. ScriptBasic proxy server is 64 bit, multi-threaded and runs as a service. A major advantage ScriptBasic brings to the table is interfacing with C libraries is a breeze not so with PHP. Here are a few examples I put on the server.

MySQL
This example uses the C MySQL client extension module to access the items table in the Classic Models DB I plan to use for the demo company data. I also display the extension module functions that are available for more information about your connection.

MySQL - Items List

Code: Script BASIC
  1. ' MySQL Classic Models - Items
  2.  
  3. IMPORT cgi.bas
  4. IMPORT mysql.bas
  5.  
  6. dbh = mysql::RealConnect("localhost","os_admin","_JaR2oO0!","classicmodels")
  7. mysql::query(dbh,"SELECT * FROM products ORDER By productLine")
  8.  
  9.  
  10. cgi::Header 200,"text/html"
  11. cgi::FinishHeader
  12.  
  13. PRINT """
  14. <html>
  15. <header>
  16. <title>ScriptBasic MySQL Example</title>
  17. </header>
  18. <body>
  19. <table>
  20. <h1>Classic Models Items List</h1>
  21. <table style="width:60%">
  22.  <tr>
  23.    <th>Product Code</th>
  24.    <th>Product Line</th>
  25.    <th>Product Vendor</th>
  26.    <th>Product Name</th>
  27.    <th>In Stock</th>
  28.    <th>Cost</th>
  29.    <th>MSRP</th>
  30.  </tr>
  31. """
  32.  
  33. WHILE mysql::FetchHash(dbh,column)
  34.   PRINT "  <tr>\n"
  35.   PRINT "    <td>", column{"productCode"}, "</td>\n"
  36.   PRINT "    <td>", column{"productLine"}, "</td>\n"
  37.   PRINT "    <td>", column{"productVendor"}, "</td>\n"
  38.   PRINT "    <td>", column{"productName"}, "</td>\n"
  39.   PRINT "    <td align=\"right\">", column{"quantityInStock"}, "</td>\n"
  40.   PRINT "    <td align=\"right\">", FORMAT("%~$###.00~",column{"buyPrice"}), "</td>\n"
  41.   PRINT "    <td align=\"right\">", FORMAT("%~$###.00~",column{"MSRP"}), "</td>\n"
  42.   PRINT "  </tr>\n"
  43. WEND
  44.  
  45. PRINT """
  46. </table>
  47. <h1>MySQL Extension Module Functions</h1>
  48. """
  49. PRINT "<b>The database handle is: </b>",dbh,"<br>"
  50. PRINT "<b>Affected rows by SELECT: </b>",mysql::AffectedRows(dbh),"<br>\n"
  51. PRINT "<b>Character set name is: </b>",mysql::CharacterSetName(dbh),"<br>\n"
  52. PRINT "<b>Last error is: </b>",mysql::ErrorMessage(dbh),"<br>\n"
  53. PRINT "<b>Client info is: </b>",mysql::GetClientInfo(),"<br>\n"
  54. PRINT "<b>Host info is: </b>",mysql::GetHostInfo(dbh),"<br>\n"
  55. PRINT "<b>Proto info is: </b>",mysql::GetProtoInfo(dbh),"<br>\n"
  56. PRINT "<b>Server info is: </b>",mysql::GetServerInfo(dbh),"<br>\n"
  57. PRINT "<b>PING result: </b>",mysql::Ping(dbh),"<br>\n"
  58. PRINT "<b>Thread ID: </b>",mysql::ThreadId(dbh),"<br>\n"
  59. PRINT "<b>Status is: </b>",mysql::Stat(dbh),"<br>\n"
  60. PRINT """
  61. </body>
  62. </html>
  63. """
  64.  
  65. mysql::Close(dbh)
  66.  


cURL

This example uses the libcurl extension module to access the current weather in Anacortes WA where I live. The Open Weather API returns a JSON response. I'm using ScriptBasic's LIKE function to parse it for a formatted result.

Current Weather in Anacortes

Code: Script BASIC
  1. ' OpenWeather - Curl Example
  2.  
  3. IMPORT cgi.bas
  4. IMPORT curl.bas
  5.  
  6. FUNCTION MATCH(segment)
  7.   MATCH = JOKER(segment)
  8. END FUNCTION
  9.  
  10. place = "Anacortes,US"
  11.  
  12. ch = curl::init()
  13. curl::option(ch, "URL", "http://api.openweathermap.org/data/2.5/weather?q=" & place & "&units=imperial&appid=MYAPIKEY")
  14. curl::option(ch, "CUSTOMREQUEST", "GET")
  15. response = curl::perform(ch)
  16. curl::finish(ch)
  17.  
  18. cgi::Header 200,"text/html"
  19. cgi::FinishHeader
  20.  
  21. PRINT """
  22. <html>
  23. <body>
  24. """
  25.  
  26. PRINT "<h2>JSON Response</h2>\n"
  27. PRINT response, "<br><br>", "\n"
  28. PRINT "<h2>LIKE Parsed</h2>\n"
  29.  
  30. IF response LIKE "*lon\":*,\"lat\":*}*temp\":*,*pressure\":*,*humidity\":*}*dt\":*,*country\":\"*\"*timezone\":*,*name\":\"*\"*" THEN
  31.    PRINT "Country:    ", MATCH(13), "<br>\n"
  32.    PRINT "City:       ", MATCH(17), "<br>\n"
  33.    PRINT "Longitude:  ", MATCH(2), "<br>\n"
  34.    PRINT "Latitude:   ", MATCH(3), "<br>\n"
  35.    PRINT "Date/Time:  ", FORMATDATE("MM/DD/YEAR 0H:0m:0s", MATCH(11) + MATCH(15)), "<br>\n"
  36.    PRINT "Tempreture: ", MATCH(5), " F<br>\n"
  37.    PRINT "Pressure:   ", MATCH(7), " hPa<br>\n"
  38.    PRINT "Humidity:   ", MATCH(9), " %<br>\n"
  39. END IF
  40.  
  41. PRINT """
  42. </body>
  43. </html>
  44. """
  45.  

echo

This is a ScriptBasic script that echos back what is sent and displays the CGI parameters. This shows the functions that are available to your application when it receives a request.

CGI Echo Example

Code: Script BASIC
  1. ' CGI Echo
  2.  
  3. GLOBAL CONST nl = "\n"
  4. CONST NumberOfCookies = 3
  5.  
  6. INCLUDE cgi.bas
  7.  
  8. OPTION cgi$Method cgi::Get OR cgi::Post
  9.  
  10. cgi::Header 200,"text/html"
  11.  
  12. FOR i = 1 TO NumberOfCookies
  13.   ' cookie(i) is i, no domain is defined, path is /, expires after 10 seconds, not secure
  14.  cgi::SetCookie "cookie" & i, i, undef, "/", gmtime() + 10, false
  15. NEXT
  16.  
  17. cgi::FinishHeader
  18.  
  19. '-------------------------------------------------------
  20. PRINT """
  21. <HTML>
  22. <HEAD>
  23. <title>CGI Echo</title>
  24. </HEAD>
  25. <BODY><font face="VERDANA" size="2">
  26. <H1>View CGI Parameters</H1>
  27. This page shows the CGI parameters the way it was uploaded.
  28. <!-- here is the result of the previous HTTP request -->
  29. <FONT SIZE="3">
  30. <PRE>
  31. CGI system variables
  32. --------------------
  33.  
  34. """
  35.  
  36. PRINT "ServerSoftware  = ", cgi::ServerSoftware(), nl
  37. PRINT "ServerName      = ", cgi::ServerName(), nl
  38. PRINT "GatewayInterface= ", cgi::GatewayInterface(),nl
  39. PRINT "ServerProtocol  = ", cgi::ServerProtocol(), nl
  40. PRINT "ServerPort      = ", cgi::ServerPort(), nl
  41. PRINT "RequestMethod   = ", cgi::RequestMethod(), nl
  42. PRINT "PathInfo        = ", cgi::PathInfo(), nl
  43. PRINT "PathTranslated  = ", cgi::PathTranslated(), nl
  44. PRINT "ScriptName      = ", cgi::ScriptName(), nl
  45. PRINT "QueryString     = ", cgi::QueryString(), nl
  46. PRINT "RemoteHost      = ", cgi::RemoteHost(), nl
  47. PRINT "RemoteAddress   = ", cgi::RemoteAddress(), nl
  48. PRINT "AuthType        = ", cgi::AuthType(), nl
  49. PRINT "RemoteUser      = ", cgi::RemoteUser(), nl
  50. PRINT "RemoteIdent     = ", cgi::RemoteIdent(), nl
  51. PRINT "ContentType     = ", cgi::ContentType(), nl
  52. PRINT "ContentLength   = ", cgi::ContentLength(), nl
  53. PRINT "UserAgent       = ", cgi::UserAgent(), nl
  54. PRINT "Cookie          = ", cgi::RawCookie(), nl
  55.  
  56. PRINT "Referer         = ", cgi::Referer(), nl
  57. PRINT "Password        = ", Environ("HTTP_PASSWORD"), nl
  58. PRINT "Full auth string= ", Environ("HTTP_AUTHORIZATION"), nl
  59. PRINT "\nCookies:\n"
  60. FOR i = 1 TO NumberOfCookies
  61.   PRINT "cookie" & i, " ", cgi::Cookie("cookie" & i), "\n"
  62. NEXT
  63.  
  64. IF cgi::RequestMethod() = "GET" THEN
  65.   PRINT "GET text field using GetParam(\"TEXT-GET\") is ", cgi::GetParam("TEXT-GET"), nl
  66. END IF
  67.  
  68. IF cgi::RequestMethod() = "POST" THEN
  69.   PRINT "POST text field using PostParam(\"TEXT-POST\") is ", cgi::PostParam("TEXT-POST"), nl
  70. END IF
  71.  
  72. PRINT """
  73. </PRE>
  74. <TABLE>
  75.  <TR>
  76.    <TD BORDER=0 BGCOLOR="EEEEEE">
  77.      <PRE>
  78.      A simple form to POST parameters:<BR>
  79.      <FORM METHOD="POST" ACTION="/home/echo">
  80.        <INPUT TYPE="TEXT" VALUE="Default POST Field Text" NAME="TEXT-POST">
  81.        <INPUT TYPE="SUBMIT" NAME="SUBMIT-BUTTON" VALUE=" POST ">
  82.      </FORM>
  83.      </PRE>
  84.    </TD>
  85.    <TD BORDER=1 width="20">&nbsp;</TD>
  86.    <TD BORDER=0 BGCOLOR="EEEEEE">
  87.    <PRE>
  88.    A simple form to GET parameters:<BR>
  89.    <FORM METHOD="GET" ACTION="/home/echo">
  90.      <INPUT TYPE="TEXT" VALUE="Default GET Field Text" NAME="TEXT-GET">
  91.      <INPUT TYPE="SUBMIT" NAME="SUBMIT-BUTTON" VALUE=" GET ">
  92.    </FORM>
  93.  
  94.    </TD>
  95.  </TR>
  96. </TABLE>
  97. </BODY>
  98. </HTML>
  99. """
  100.  


« Last Edit: October 23, 2021, 07:14:10 pm by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #13 on: October 23, 2021, 11:57:36 pm »
I wanted to make sure AJAX was going to work with the ScriptBasic application proxy server. I'm happy to say it works really well. This example list the Classic Models Items  based on the Product Line you chose.

ScriptBasic AJAX Example

sbajax (This could have been a HTML or PHP script - I wanted to run everything on the proxy server)
Code: Script BASIC
  1. ' ScriptBasic AJAX & MySQL
  2.  
  3. IMPORT cgi.bas
  4.  
  5. OPTION cgi$Method cgi::Get OR cgi::Post
  6.  
  7. cgi::Header 200,"text/html"
  8. cgi::FinishHeader
  9.  
  10. PRINT """
  11. <html>
  12. <head>
  13. <script>
  14. function showItems(str) {
  15.  if (str == "") {
  16.    document.getElementById("results").innerHTML = "";
  17.    return;
  18.  } else {
  19.    var xmlhttp = new XMLHttpRequest();
  20.    xmlhttp.onreadystatechange = function() {
  21.      if (this.readyState == 4 && this.status == 200) {
  22.        document.getElementById("results").innerHTML = this.responseText;
  23.      }
  24.    };
  25.    xmlhttp.open("GET","/home/getitems.sb?q="+str,true);
  26.    xmlhttp.send();
  27.  }
  28. }
  29. </script>
  30. </head>
  31. <body>
  32.  
  33. <form>
  34.  <select name="items" onchange="showItems(this.value)">
  35.    <option value="">Product Line</option>
  36.    <option value="Classic Cars">Classic Cars</option>
  37.    <option value="Motorcycles">Motorcycles</option>
  38.    <option value="Planes">Planes</option>
  39.    <option value="Ships">Ships</option>
  40.    <option value="Trains">Trains</option>
  41.    <option value="Trucks and Buses">Trucks and Buses</option>
  42.    <option value="Vintage Cars">Vintage Cars</option>
  43.  </select>
  44. </form>
  45. <br>
  46. <div id="results"></div>
  47.  
  48. </body>
  49. </html>
  50. """
  51.  

getitems.sb
Code: Script BASIC
  1. ' AJAX - getitems.sb
  2.  
  3. IMPORT cgi.bas
  4. IMPORT mysql.bas
  5.  
  6. cgi::Header 200,"text/html"
  7.  
  8. PRINT """
  9. <!DOCTYPE html>
  10. <html>
  11. <head>
  12. <style>
  13. table {
  14.  width: 100%;
  15.  border-collapse: collapse;
  16. }
  17.  
  18. table, td, th {
  19.  border: 1px solid black;
  20.  padding: 5px;
  21. }
  22.  
  23. th {text-align: left;}
  24. </style>
  25. </head>
  26. <body>
  27. """
  28.  
  29. product_line = cgi::GetParam("q")
  30.  
  31. dbh = mysql::RealConnect("localhost","USERID","PASSWORD","classicmodels")
  32. mysql::query(dbh,"SELECT * FROM products WHERE productLine = '" & product_line & "'")
  33.  
  34. PRINT """
  35. <table>
  36.  <tr>
  37.    <th>Product Code</th>
  38.    <th>Product Line</th>
  39.    <th>Product Vendor</th>
  40.    <th>Product Name</th>
  41.    <th>In Stock</th>
  42.    <th>Cost</th>
  43.    <th>MSRP</th>
  44.  </tr>
  45. """
  46.  
  47. WHILE mysql::FetchHash(dbh,column)
  48.   PRINT "  <tr>\n"
  49.   PRINT "    <td>", column{"productCode"}, "</td>\n"
  50.   PRINT "    <td>", column{"productLine"}, "</td>\n"
  51.   PRINT "    <td>", column{"productVendor"}, "</td>\n"
  52.   PRINT "    <td>", column{"productName"}, "</td>\n"
  53.   PRINT "    <td align=\"right\">", column{"quantityInStock"}, "</td>\n"
  54.   PRINT "    <td align=\"right\">", FORMAT("%~$###.00~",column{"buyPrice"}), "</td>\n"
  55.   PRINT "    <td align=\"right\">", FORMAT("%~$###.00~",column{"MSRP"}), "</td>\n"
  56.   PRINT "  </tr>\n"
  57. WEND
  58.  
  59. PRINT """
  60. </table>
  61. </body>
  62. </html>
  63. """
  64.  
  65. mysql::Close(dbh)
  66.  


« Last Edit: October 25, 2021, 12:33:04 am by John Spikowski »

John Spikowski

  • Administrator
  • *****
  • Posts: 62
Re: Project Announcement
« Reply #14 on: October 25, 2021, 12:31:41 am »
This AJAX example of a login form with length validation uses a HTML, JS, CSS and ScriptBasic file for the AJAX processing. Once the Login Submit is clicked it runs the sbajax example I posted previously. I modified the sbajax script to allow both GET and POST requests.

ScriptBasic AJAX Login Example

index.html
Code: HTML
  1. <!DOCTYPE html>
  2. <link href="style.css" rel="stylesheet" type="text/css">
  3. <script src="script.js"></script>
  4. </head>
  5. <div id="mainform">
  6. <div class="innerdiv">
  7. <form action='/home/sbajax' id="myForm" method='post' name="myForm">
  8. <center><img src='forum_logo.png' alt='Open Sage' border='0' ></center>
  9. <tr>
  10. <td>User Name</td>
  11. <td><input id='username1' name='username' onblur="validate('username', this.value)" type='text'></td>
  12. <td>
  13. <div id='username'></div>
  14. </td>
  15. </tr>
  16. <tr>
  17. <td>Password</td>
  18. <td><input id='password1' name='password' onblur="validate('password', this.value)" type='password'></td>
  19. <td>
  20. <div id='password'></div>
  21. </td>
  22. </tr>
  23. <input onclick="checkForm()" type='button' value='Login Submit'>
  24. </form>
  25. </div>
  26. </body>
  27. </html>
  28.  

style.css
Code: CSS
  1. @import "http://fonts.googleapis.com/css?family=Fauna+One|Muli";
  2. #mainform{
  3. width:960px;
  4. margin:20px auto;
  5. padding-top:20px;
  6. font-family:'Fauna One',serif
  7. }
  8. .innerdiv{
  9. width:65%;
  10. float:left
  11. }
  12. form{
  13. background-color:#fff;
  14. color:#123456;
  15. box-shadow:0 1px 1px 1px gray;
  16. width:500px;
  17. margin:50px 250px 0 50px;
  18. float:left;
  19. height:300px;
  20. padding:10px
  21. }
  22. input{
  23. width:250px;
  24. height:30px;
  25. margin-top:10px;
  26. border-radius:3px;
  27. padding:2px;
  28. box-shadow:0 1px 1px 0 #a9a9a9;
  29. margin:10px
  30. }
  31. input[type=button]{
  32. background-color:#8FBC8B;
  33. border:1px solid #fff;
  34. font-family:'Fauna One',serif;
  35. font-weight:700;
  36. font-size:18px;
  37. color:#fff;
  38. width:50%;
  39. margin-left:125px;
  40. margin-top:30px
  41. }
  42. span{
  43. color:green
  44. }
  45. #myForm div{
  46. color:red;
  47. font-size:14px
  48. }
  49.  

script.js
Code: Javascript
  1. function checkForm() {
  2. // Fetching values from all input fields and storing them in variables.
  3. var name = document.getElementById("username1").value;
  4. var password = document.getElementById("password1").value;
  5. //Check input Fields Should not be blanks.
  6. if (name == '' || password == '') {
  7. alert("Fill All Fields");
  8. } else {
  9. //Notifying error fields
  10. var username1 = document.getElementById("username");
  11. var password1 = document.getElementById("password");
  12. //Check All Values/Informations Filled by User are Valid Or Not.If All Fields Are invalid Then Generate alert.
  13. if (username1.innerHTML == 'Must be 3+ letters' || password1.innerHTML == 'Password too short') {
  14. alert("Fill Valid Information");
  15. } else {
  16. //Submit Form When All values are valid and run sbajax.
  17. document.getElementById("myForm").submit();
  18. }
  19. }
  20. }
  21. // AJAX code to check input field values when onblur event triggerd.
  22. function validate(field, query) {
  23. var xmlhttp;
  24. if (window.XMLHttpRequest) { // for IE7+, Firefox, Chrome, Opera, Safari
  25. xmlhttp = new XMLHttpRequest();
  26. } else { // for IE6, IE5
  27. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  28. }
  29. xmlhttp.onreadystatechange = function() {
  30. if (xmlhttp.readyState != 4 && xmlhttp.status == 200) {
  31. document.getElementById(field).innerHTML = "Validating..";
  32. } else if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  33. document.getElementById(field).innerHTML = xmlhttp.responseText;
  34. } else {
  35. document.getElementById(field).innerHTML = "";
  36. }
  37. }
  38. xmlhttp.open("GET", "/home/validation.sb?field=" + field + "&query=" + query, false);
  39. xmlhttp.send();
  40. }
  41.  

validation.sb
Code: Script BASIC
  1. ' ScriptBasic AJAX Validation
  2.  
  3. IMPORT cgi.bas
  4.  
  5. cgi::Header 200,"text/html"
  6.  
  7. PRINT """
  8. <!DOCTYPE html>
  9. <html>
  10. <body>
  11. """
  12. value = cgi::GetParam("query")
  13. formfield = cgi::GetParam("field")
  14.  
  15. ' Check length of username for greater than 3 characters
  16.  
  17. IF formfield = "username" THEN
  18.   IF LEN(value) < 4 THEN
  19.     PRINT "Must be 3+ letters"
  20.   ELSE
  21.     PRINT "<span>Valid</span>"
  22.   END IF
  23. END IF
  24.  
  25. ' Check length of password for greater than 5 characters
  26.  
  27. IF formfield = "password" THEN
  28.   IF LEN(value) < 6 THEN
  29.     PRINT "Password too short"
  30.   ELSE
  31.     PRINT "<span>Strong</span>"
  32.   END IF
  33. END IF
  34.  
  35. PRINT """
  36. </body>
  37. </html>
  38. """
  39.  
« Last Edit: October 26, 2021, 04:10:57 am by John Spikowski »